标签:
string coonString="server=.;database=MySchool(你的数据库名称);uid=sa(登录数据库时的名称);pwd=123(密码可为空)";
SqlConnection coon=new SqlConnection(coonString);
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "select id,name from table1";//sql语句
conn.Open();//打开连接
cmd.ExecuteNonQuery();//执行sql
标签:
原文地址:http://www.cnblogs.com/JYYJ/p/4469672.html