i have one combobox in my c# app, and one combobox in my access database, i want to populate the combobox list in the access database to be shown in the app combobox.
any ideas
thanks
i have one combobox in my c# app, and one combobox in my access database, i want to populate the combobox list in the access database to be shown in the app combobox.
any ideas
thanks
مننساش
using System.Data.OleDb;
OleDbConnection sc=new OleDbConnection("Data Source=C:\\db1.mdb;Provider=Microsoft.Jet.OLEDB.4.0;");
OleDbCommand com=new OleDbCommand();
OleDbDataReader sdr;
com.Connection = sc;
com.CommandText = "select * from logn ";
sc.Open();
try
{
sdr = com.ExecuteReader();
while (sdr.Read())
{
comboBox1.Items.Add(sdr["pass"].ToString().Trim());
}
sc.Close();
}
catch (Exception) { }برو كتب:مننساشusing System.Data.OleDb;OleDbConnection sc=new OleDbConnection("Data Source=C:\\db1.mdb;Provider=Microsoft.Jet.OLEDB.4.0;"); OleDbCommand com=new OleDbCommand(); OleDbDataReader sdr; com.Connection = sc; com.CommandText = "select * from logn "; sc.Open(); try { sdr = com.ExecuteReader(); while (sdr.Read()) { comboBox1.Items.Add(sdr["pass"].ToString().Trim()); } sc.Close(); } catch (Exception) { }
I have taken your code i replaced the data soirce to my actual data source (the mdb file path), logn with my table name, pass with my column name.
but still nothing appeared in the combobox
apreciate your response
هذا الموضوع مغلق.