Hi,
I want to insert "all data" from a table of access database (*.mdb) to list box & combo box.
Please help me.
I upload the database file & csproject.
Thank you in advance!
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Hirendra SisodiyaPosted Jul 16, 2010, 3:16 AM
Tanmay SarkarPosted Jul 16, 2010, 3:11 AM
string sqlquery = "select * from " + tablename + " order by " + displaycol + " asc";
Now it's OK!
Tanmay SarkarPosted Jul 13, 2010, 9:26 AM
but how i serialize them, consider 9834...... ,98444....,932222....,
when i click 9 all 3 data will appear in list box, but when i change to 98 then only 2 two no will come..
Thanks for your code, it's good as well as help full. :-)
Hirendra SisodiyaPosted Jul 13, 2010, 5:45 AM
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection thisConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Put here database path with (extension .mdb)");
OleDbCommand cmd = new OleDbCommand();
string str = "select * from mytable";
cmd.CommandText = str;
thisConnection.Open();
OleDbDataAdapter mainTableAdapter = new OleDbDataAdapter(str, thisConnection);
DataSet thisDataSet = new DataSet();
try
{
mainTableAdapter.Fill(thisDataSet, "[Project Description]");
}
catch (Exception ex)
{
string error = ex.ToString();
}
thisConnection.Close();
comboBox1.DataSource = thisDataSet.Tables[0];
comboBox1.DisplayMember = "Name";
comboBox1.ValueMember = "Contact";
}
thanks
Please mark as answer if it helps