Click here to Skip to main content
15,885,771 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
hi m not able to get data from access database into combobox when i click on it .....i juzz want to get one column in combobox...plzz help
Posted
Comments
joshrduncan2012 25-Oct-12 14:40pm    
What have you tried so far? Can you show us your attempt at getting this accomplished?
Sergey Alexandrovich Kryukov 25-Oct-12 15:00pm    
Not a question. Can you ask one?
--SA
Sandeep Mewara 25-Oct-12 15:25pm    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.
fjdiewornncalwe 25-Oct-12 15:56pm    
Let's see what you have tried so that we have a starting point.

page_load
{
oledbconnection con =new oledbconnection(connectionstring);
con.open();
oledbdataadaptor adp=new oledbdataadaptor("select columnname from tablename",con);
dataset ds =new dataset();
adp.fill(ds,"tabname");
combobox1.text=ds.tables["tabname"].itemarray[0];


}
 
Share this answer
 
Comments
Member 8746257 26-Oct-12 16:10pm    
hiee

i tried this bt its showing an error 4 dat ...."itemarray[0]" thing
in following line
combobox1.text=ds.tables["tabname"].itemarray[0];


error is:
Error 2 'System.Data.DataTable' does not contain a definition for 'itemarray' and no extension method 'itemarray' accepting a first argument of type 'System.Data.DataTable' could be found (are you missing a using directive or an assembly reference?)

c if u can help in dat...
thnx in advance
hello

you can get your column by this step:

1-click on your combobox and go to comboboxTask
2-choose your data source(access database and your table)
3-choose your column that your want display in combobox, in Displaymember
4-run your Application
Image and video hosting by TinyPic

i hope this will be useful
 
Share this answer
 
Comments
Member 8746257 26-Oct-12 16:00pm    
hiee

i tried this bt getting t following error....

ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

c if u can help in dat....
thnx in advance
mhd.sbt 27-Oct-12 1:52am    
in "dataSourceConfiguration Wizard" and in "Choose your database connection" step you should be Select New connection and from open window select "Microsoft Access Database file" and click ok.
from this window you should be select your access database and then and continue next step...
Member 8746257 28-Oct-12 9:04am    
hiee

thnx alot ...it worked like heaven.....:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900