Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 20, 2012 02:09 PM by moe_caruso
Nov 20, 2012 06:23 AM|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 06:35 AM|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 08:36 AM|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 01:17 PM|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 01:52 PM|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 02:09 PM|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 !