how colors will send to sql server

how colors will send to sql server

Page 1 of 1

2 Replies - 1890 Views - Last Post: 20 August 2009 - 01:34 AM Rate Topic: -----

#1 virgindayana  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 08-August 09

how colors will send to sql server

Posted 20 August 2009 - 12:03 AM

I have 15 checkboxes in my vb.net form

during runtime some of the checkboxes in control array are set backcolor by the colordialog using the following code


 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim a As Integer

		For a = 1 To 15
			If ColorDialog1.ShowDialog() Then
				checkarray(a).BackColor = ColorDialog1.Color
				If ColorDialog1.ShowDialog = DialogResult.Cancel Then
					Exit For
				End If
			End If
		Next
	End Sub



My question is i want to send the colors filled in the check boxes into the sql server table throug insertsql statement
my trial code is as follows but it is wrong
insertsql = "insert into colordetails(model,color)values('" & ComboBox1.Text & "','" & checkarray(a).BackColor & "')"


colordetails in tablename in sql server and model and color are field names in that table
please help

Is This A Good Question/Topic? 0
  • +

Replies To: how colors will send to sql server

#2 DataPriest  Icon User is offline

  • D.I.C Head

Reputation: 20
  • View blog
  • Posts: 57
  • Joined: 29-April 09

Re: how colors will send to sql server

Posted 20 August 2009 - 12:54 AM

Try changing your color data type to Integer and use the following code:

Try this code
insertsql = "INSERT INTO colordetails(model, color) VALUES ('" & ComboBox1.Text & "', " & checkarray(a).BackColor.ToArgb & ")"


To reassign the color, you then use FromArgb Method.
Was This Post Helpful? 1
  • +
  • -

#3 virgindayana  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 9
  • Joined: 08-August 09

Re: how colors will send to sql server

Posted 20 August 2009 - 01:34 AM

View PostDataPriest, on 19 Aug, 2009 - 11:54 PM, said:

Try changing your color data type to Integer and use the following code:

Try this code
insertsql = "INSERT INTO colordetails(model, color) VALUES ('" & ComboBox1.Text & "', " & checkarray(a).BackColor.ToArgb & ")"


To reassign the color, you then use FromArgb Method.


Thank you sir
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1