这个我是知道的啦!我写了段代码可是表却无法显示啊
private void dataGrid1_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
//创建连接并填充数据
sqlCon = new SqlConnection("server = (local);database = Northwind;integrated security = SSPI");
da = new SqlDataAdapter();
dataSet= new DataSet();
dataSet.Tables.Add("Employees");
dataSet.Tables.Add("Products");
da.Fill(dataSet);
}
private void button1_Click(object sender, System.EventArgs e)
{
//将dataset中的表"Employees"进行帮定并显示
this.dataGrid1.SetDataBinding(dataSet,"Employees");
}
private void button2_Click(object sender, System.EventArgs e)
{
//将dataset中的表"Products"进行帮定并显示
this.dataGrid1.SetDataBinding(dataSet,"Products");
}
我知道这段代码有问题,可是就是不知道怎么改!