我没有彻底检查,也一直在寻找有关此问题的论坛问题,但我似乎无法解决这个问题 这是错误:“System.Data.dll中出现'System.Data.SqlClient.SqlException'类型的异常,但未在用户代码中处理
其他信息:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及SQL“
`public int CustomerInsert(){
int result = 0;
string queryStr = "INSERT INTO Customer(CustLoginID,CustName,CustGender,CustDOB,CustAddress,CustTelNo,CustEmail,CustPassword)"
+ "values (@CustLoginID,@CustName,@CustGender,@CustDOB,@CustAddress,@CustTelNo,@CustEmail,@CustPassword)";
SqlConnection conn = new SqlConnection(_connStr);
SqlCommand cmd = new SqlCommand(queryStr, conn);
cmd.Parameters.AddWithValue("@CustLoginID", this.CustLoginID);
cmd.Parameters.AddWithValue("@CustName", this.CustName);
cmd.Parameters.AddWithValue("@CustGender", this.CustGender);
cmd.Parameters.AddWithValue("@CustDOB", this.CustDOB);
cmd.Parameters.AddWithValue("@CustAddress", this.CustAddress);
cmd.Parameters.AddWithValue("@CustTelNo", this.CustTelNo);
cmd.Parameters.AddWithValue("@CustEmail", this.CustEmail);
cmd.Parameters.AddWithValue("@CustPassword", this.CustPassword);
conn.Open();
result += cmd.ExecuteNonQuery();
conn.Close();
return result;
}`