没写啊 我只写了显示的那个
我那代码给你看看
OleDbConnection dbconn = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;data source=F:\C#\新建文件夹 (2)\bin\Debug\tongxunlu.mdb");
dbconn.Open();
//OleDbCommand cmd=new OleDbCommand("select * from test1",dbconn);
OleDbCommand cmd = dbconn.CreateCommand();
cmd.CommandText = "select * from myfriend";
cmd.CommandType = CommandType.Text;
OleDbDataReader reader = cmd.ExecuteReader();
//string output;
while (reader.Read())
{
//output = string.Format("custormer {0}:{1} works for {2}", reader.GetString(1), reader.GetString(2), reader.GetString(3));
//Console.WriteLine(output);
txtName.Text = reader["xingming"].ToString();
txtdianhua.Text = reader["dianhua"].ToString();
txtQQ.Text = reader["QQ"].ToString();
txtxingbie.Text =reader["xingbie"].ToString();
txtzhuzhi.Text = reader["zhuzhi"].ToString();
}
有点不懂 我把代码给你看看
OleDbConnection dbconn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data source=tongxunlu.mdb");
dbconn.Open();
//OleDbCommand cmd=new OleDbCommand("select * from test1",dbconn);
OleDbCommand cmd = dbconn.CreateCommand();
cmd.CommandText = "select * from myfriend";
cmd.CommandType = CommandType.Text;
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
lstProducts.Text = reader["xingming"].ToString();
}
下拉控件的属性是lstProducts