标签:nbsp use 连接 sql log comm open ble sel
SqlConnection sqlcon =new SqlConnection( "Data Source=.;Initial Catalog=BGS;User ID=sa");//sql连接语句
sqlcon.Open(); //连接数据库
SqlDataAdapter sqladt = new SqlDataAdapter(); //适配器
SqlCommand command = new SqlCommand("select * from gjbus",sqlcon); //sql操作语句1
sqladt.SelectCommand = command; //执行语句1
sqladt.Fill(gjdt); //填充至datatable
sqladt.SelectCommand.CommandText = "select * from ctbus"; //sql操作语句2及执行
sqladt.Fill(ctdt); //填充
标签:nbsp use 连接 sql log comm open ble sel
原文地址:http://www.cnblogs.com/clarklxr/p/6186186.html