When you set the DataSource you also need to set the ...
.DisplayMember = "SomeTextToShow"
.ValueMember = "SomeID"
The above 'SomeXXX' are field names from your table.
Try this...
'the displayed text
MessageBox.Show(cboCustomers.SelectedValue.ToString)
or for its' index position in the the control
MessageBox.Show(cboCustomers.SelectedIndex.ToString)
'or even
MessageBox.Show(cboCustomers.Text)
With SQL Server the number is created only when the row is saved/inserted. So yes, you cannot know what that number is until the new row is inserted.
What is the PK used for elsewhere on the screen, is it part of another field, perhaps you can circumvent this approach.
Short answer: Don't.
Instead store the path of the image. This will save a considerable amount of database size. Retrieving/displaying the images thereafter is quite simple.
What I'm thinking is; When you search a product by ID it will return (let's say) red, white, black, and Small, Med, Large, XLarge.
Does this mean that each color has a matching size?
when you say 'i have hidden some Fields' , do you mean you made a column not visible?
you can use e.Item.Cells(0).tostring in the selectedindexchange event
sorry if the syntax is off, I don't have .NET handy.
I just thought of something, what if the user selects a color and size that do not exist?
Isn't it better to display each color and size per product as the user selects a product?
Since you're binding two controls you should seperate the SQL into two statements.
Excluding Productsxsizes from Colours will give you the Distinct you need. (and vice versa)
You can parse the file and load an array or a dataview, and perhaps for each item in the TH tags create the header for each datagrid column.
Once the content resides in an array you can Bind it to the datagrid.
An important note, SP3 is needed on the Client (dev machine) as well as the Server.
See if this is helpfull ... http://www.sqldev.net/download/dts/DotNETCookBook.pdf
I just tried it out and you need to make a few changes...
I have not run the following, but it should work.
oConnection = goPackage.Connections.New("DTSFlatFile")
'change this....
oConnection.ConnectionProperties("Data Source") = "C:\test.txt"
'to this....
oConnection.ConnectionProperties.Item("Data Source").Value = "C:\test.txt"