c#简单数据绑定显示datasourse值不能为null,源代码如下,到底是哪儿错了?
privatevoidForm2_Load(objectsender,EventArgse){stringstrCon="Provider=Microsoft.ACE.O...
private void Form2_Load(object sender, EventArgs e)
{
string strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=database.accdb";
OleDbConnection myConn = new OleDbConnection(strCon);
string strCom = " SELECT * FROM database";
myDataSet = new DataSet();
myConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
myCommand.Fill(myDataSet, "data");
myConn.Close();
}
private void button3_Click(object sender, System.EventArgs e)
{
textBox2.DataBindings.Add("Text", myDataSet, "ID");
} 展开
{
string strCon = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=database.accdb";
OleDbConnection myConn = new OleDbConnection(strCon);
string strCom = " SELECT * FROM database";
myDataSet = new DataSet();
myConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
myCommand.Fill(myDataSet, "data");
myConn.Close();
}
private void button3_Click(object sender, System.EventArgs e)
{
textBox2.DataBindings.Add("Text", myDataSet, "ID");
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询