| 实例: SqlConnection conn = new SqlConnection("integrated security=yes;server=.;database=StudentMan");
 
 public void InsertUser(string name, string passwrod)
 {
 try
 {
 SqlConnection con = new SqlConnection(Connection.ReturnCon());//新数据库连接
 con.Open();
 
 //Guid gid = Guid.NewGuid();
 Guid gid = new Guid();
 SqlCommand com = new SqlCommand("insert ST_Users(guid) values('" + gid+ "')", con);//SQL书写
 com.ExecuteNonQuery();//执行SQL
 con.Close();
 }
 catch (Exception ex)
 {
 
 Error.ErrorWrite("LoginDAL", "InsertUser", ex.Message, System.DateTime.Now.ToString());
 
 }
 }
 |