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 helper类,但该类的成员无法访问。
答案 0 :(得分:1)
在当前上下文中未定义的连接字符串出错?
请使用字符串变量并在代码上方初始化它并尝试运行它
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));