Last post Nov 20, 2012 10:09 AM by moe_caruso
Nov 20, 2012 02:23 AM|moe_caruso|LINK
Hello guys ,
I am trying to populate a combox from a dataset.
I use the followong code :
Dim getCustomers As String = "select * from rmm_customers"
Dim ds As New DataSet
Dim cmd As New OracleCommand(getCustomers, conn)
Dim da As New OracleDataAdapter(cmd)
cbCustomer.DataSource = ds
cbCustomer.ValueMember = "custmr_code"
cbCustomer.DisplayMember = "custmr_name"
But I get an excpetion at : " cbCustomer.ValueMember = "custmr_code" "
I can't know what is the exception,because it's says "there is an exception at the follwoing line,but can't display the message because NETCE 3.5 is not installed", something like that.
Everything is correct,as far as I know. Please anyone has an idea what throws this exception?
Thank you very much.
Nov 20, 2012 02:35 AM|sargamlucy|LINK
Unfortunately yor error message is not displayed, very bad. A common eror here is custmr_code is not a part of datatable. Just check what is the exact column name in your rmm_customers table and copy and paste the same here. Also check if your query returns
any value at all? If it returns zero records, try adding one blank record to it and then set the data source.
Nov 20, 2012 04:36 AM|moe_caruso|LINK
The query does return data. I have checked ds.rows.count, and it returned the right number.
I am also sure of the column name in the database,so there is nothing wrong.
any more suggestions? I am very desperate, I can't solve it.
Nov 20, 2012 09:17 AM|sargamlucy|LINK
I stated the common errors, but withuot knowing the exact error, it's difficult to tell any solution. Can't you run this code somewhere where it will show the error? That would bring you the solution. DropDownFields have some binding property, which should
be set true. Have you checked that?
Nov 20, 2012 09:52 AM|roopeshreddy|LINK
Looks like it's an application for Windows Handheld device! Is that right?
If yes, did you tried caching the exeption using Exception class?
Hope it helps u...
Nov 20, 2012 10:09 AM|moe_caruso|LINK
Yes it's a windows mobile application. Finally I have found the solution, it shoud be like this :
cbCycle.DataSource = ds.Tables("rmm_customer_cycles")
cbCycle.ValueMember = ds.Tables(0).Columns(0).ColumnName
cbCycle.DisplayMember = ds.Tables(0).Columns(0).ColumnName
instead of :
cbCycle.DataSource = ds
cbCycle.ValueMember = "custmr_code"
cbCycle.DisplayMember = "custmr_name"
Thanks for help anyway !