display information from access table in a combobox

Thread Solved

Join Date: Mar 2008
Posts: 33
Reputation: SubProf is an unknown quantity at this point 
Solved Threads: 0
SubProf's Avatar
SubProf SubProf is offline Offline
Light Poster

display information from access table in a combobox

 
0
  #1
Mar 7th, 2008
Hello,

I have a combobox on my form that I need to be populated with data from a table in MS Access. I am new to coding in Visual c# and would appreciate any help I can get with this.

Thanks in advance,

SubProf
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: display information from access table in a combobox

 
0
  #2
Mar 7th, 2008
Hi SubProf... Welcome to Daniweb friend
i think you post thread in wrong forum..
this forum for vb not for c#...
please post in current forum -> C#
Last edited by Jx_Man; Mar 7th, 2008 at 1:02 pm.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: display information from access table in a combobox

 
0
  #3
Mar 8th, 2008
Originally Posted by SubProf View Post
Hello,

I have a combobox on my form that I need to be populated with data from a table in MS Access. I am new to coding in Visual c# and would appreciate any help I can get with this.

Thanks in advance,

SubProf
Though this is not the right forum to reply but probably the following code should your answer. Follow it.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. using system.data
  2.  
  3. oledb.oldedbconnection con;
  4. string sql;
  5. dataset ds=new dataset();
  6. oledb.oledbDataAdaptar da;
  7. int maxrows=0,i=0;
  8.  
  9. con=new oledb.oldedbconnection();
  10. con.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\STUDENT.MDB;Persist Security Info=False";
  11. con.open();
  12.  
  13. sql="select name from information order by rollno";
  14. da=new oledb.oledbDataAdaptar(sql,con);
  15. da.fill(ds,"Information");
  16.  
  17. maxrows=ds.tables("Information").Rows.Count();
  18.  
  19. dropdownlist1.items.clear
  20.  
  21. for(;i<=maxrows-1;i++)
  22. {
  23. dropdownlist1.items.add ds.tables("Information").Rows(i).Item("Name");
  24. }

regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 33
Reputation: SubProf is an unknown quantity at this point 
Solved Threads: 0
SubProf's Avatar
SubProf SubProf is offline Offline
Light Poster

Re: display information from access table in a combobox

 
0
  #4
Mar 10th, 2008
choudhuryshouvi and Jx_Man,

Thank you for your help in solving my problem. Sorry I posted in the wrong forum.

Thanks again,

SubProf
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC