Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > data set on combobox
 

data set on combobox

hello,

i have two combo box. the first combobox (cbtype.text) was filled from dataset, now the data on the next combobox will depends on the data from the first combo box. my data will come from access thru dsn


heres my sql for the 2nd combo box
SELECT MODEL, type, ord
FROM MODEL
where type=cbtype.text


but it is not working, any help please
medel  Saturday, November 04, 2006 2:38 PM

well it should be:

"SELECT Model, type, ord FROM Models WHERE type = '" + cbtype.text + "'"

as well as this, looks like you are creating a filtered drop down combobox correct? if so, you maybe better of filling all the required info in a dataset and filter that than to query SQL every time as it can be expensive

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=786157&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=868748&SiteID=1

ahmedilyas  Saturday, November 04, 2006 8:58 PM

well it should be:

"SELECT Model, type, ord FROM Models WHERE type = '" + cbtype.text + "'"

as well as this, looks like you are creating a filtered drop down combobox correct? if so, you maybe better of filling all the required info in a dataset and filter that than to query SQL every time as it can be expensive

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=786157&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=868748&SiteID=1

ahmedilyas  Saturday, November 04, 2006 8:58 PM
hello, i already filled my first combobox with dataset now on my second combobox, i followed your suggestion but still nothing appears.

i followed your link but if possible i would like to fill my 2nd combobox with almost the same as my 1st combo box. less codes and just insert my sql on the dataset query builder.

here's my query now on my dataset
SELECT MODEL, type, ord
FROM MODEL
where type=?


i have this on my selected index change

Me.MODELTableAdapter.Fill(Me.ModelDataSet1.MODEL, CbType.Text)


medel  Sunday, November 05, 2006 6:51 AM
not sure I follow exactly. what are you trying to fill in the 2nd combobox and how are you doing this?
ahmedilyas  Sunday, November 05, 2006 2:42 PM
hello,

i have this on my form load event to fill my first combo box (CbType.Text)

Me.Truck_typeTableAdapter.Fill(Me.TruckTYpeDataSet1.truck_type)


then on my CbType selected index changed

Me.MODELTableAdapter.Fill(Me.ModelDataSet1.MODEL, "CbType.Text")


inside the ModelDataSet1 i have these sql

SELECT MODEL, type, ord
FROM MODEL
where type=?

in which my question mark was supposed to be replaced by CbTYpe.text
i'm having these error

Error[HY104][Microsoft][ODBC Microsoft Access Driver]Invalid Precision Value

oh and by the way i'm using microsoft odbc dsn to connect to data source

medel  Monday, November 06, 2006 4:26 AM
sir,

i've made a printscreen of the error

http://www.geocities.com/corvusph/error1.gif

thanks

medel  Monday, November 06, 2006 11:22 AM

Were you able to get around the problem? I am also using ODBC to connect to my database. I get results in the query builder just fine, but when I go to Preview Data, Iget the same error:

ERROR [HY104][Microsoft][ODBC Microsoft Access Driver]Invalid Precision Value

Is it on the database end or my dataset end? Why are records returned in the Query Builder, but not when iIwant to Preview the data?

Thanks in Advance!

dmaps  Saturday, February 24, 2007 5:45 PM

You can use google to search for other answers

Custom Search

More Threads

• Add results of form into a MSQL DB
• Datagridview overwriting all rows if populated unfocussed!
• DataGridView hex data entry
• Use SQL on the network with C#
• weird problem binding datasource to a combo box
• File is being used error
• BindingSource Filter max lenght and stack overflow
• RowFilter issue?
• DataGridView
• Datagridview scrolling bug? due to invisible row's height adjust