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

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.

using system.data

oledb.oldedbconnection con;
string sql;
dataset ds=new dataset();
oledb.oledbDataAdaptar da;
int maxrows=0,i=0;

con=new oledb.oldedbconnection();
con.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\STUDENT.MDB;Persist Security Info=False";
con.open();

sql="select name from information order by rollno";
da=new oledb.oledbDataAdaptar(sql,con);
da.fill(ds,"Information");

maxrows=ds.tables("Information").Rows.Count();

dropdownlist1.items.clear

for(;i<=maxrows-1;i++)
{
  dropdownlist1.items.add ds.tables("Information").Rows(i).Item("Name");
}

regards
Shouvik

choudhuryshouvi and Jx_Man,

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

Thanks again,

SubProf

This question has already been answered. Start a new discussion instead.