如何在 asp.net 中实现 Sql 助手 class
How to implement Sql helper class in asp.net
SqlHelper.ExecuteNonQuery(conString, CommandType.StoredProcedure, "UserRegister_Insert",
new SqlParameter("@firstname",SqlDbType.NVarChar,50),
new SqlParameter("@lastname",LastName),
new SqlParameter("@email",Email),
new SqlParameter("@password",Password),
new SqlParameter("@contactno",ContactNo));
我也实现了 sql 助手 class 但是 class 的成员无法访问。
当前上下文中未定义的连接字符串出错?
请取一个字符串变量并在您的代码上方对其进行初始化,然后尝试 运行 it
String conString=System.Configuration.ConfigurationManager.
ConnectionStrings["connectionStringName"].ConnectionString;//your connection string name
SqlHelper.ExecuteNonQuery(conString, CommandType.StoredProcedure, "UserRegister_Insert",
new SqlParameter("@firstname",SqlDbType.NVarChar,50),
new SqlParameter("@lastname",LastName),
new SqlParameter("@email",Email),
new SqlParameter("@password",Password),
new SqlParameter("@contactno",ContactNo));
SqlHelper.ExecuteNonQuery(conString, CommandType.StoredProcedure, "UserRegister_Insert",
new SqlParameter("@firstname",SqlDbType.NVarChar,50),
new SqlParameter("@lastname",LastName),
new SqlParameter("@email",Email),
new SqlParameter("@password",Password),
new SqlParameter("@contactno",ContactNo));
我也实现了 sql 助手 class 但是 class 的成员无法访问。
当前上下文中未定义的连接字符串出错?
请取一个字符串变量并在您的代码上方对其进行初始化,然后尝试 运行 it
String conString=System.Configuration.ConfigurationManager.
ConnectionStrings["connectionStringName"].ConnectionString;//your connection string name
SqlHelper.ExecuteNonQuery(conString, CommandType.StoredProcedure, "UserRegister_Insert",
new SqlParameter("@firstname",SqlDbType.NVarChar,50),
new SqlParameter("@lastname",LastName),
new SqlParameter("@email",Email),
new SqlParameter("@password",Password),
new SqlParameter("@contactno",ContactNo));