ASP.C#向SQL server中添加数据,大家看我写的这个方法哪里有问题,怎么添加不进去呢,运行的时候没报错。
publicvoidsaveInfoToDatabase(stringuserName,stringuserPassword,stringuserEmail,string...
public void saveInfoToDatabase(string userName,string userPassword,string userEmail,string userQuestion,string userAnswer,string registerTime)
{
String str = "Server=.;DataBase=CommunicationSystem;User=sa;Password=521521";
SqlConnection conn = new SqlConnection(str);
conn.Open();
SqlCommand comm = new SqlCommand("insert into UserInfo values ('"+userName
+"','"+userPassword+"','"+userQuestion+"','"+userAnswer+"','"+userEmail+"','"+registerTime+"')", conn);
comm.ExecuteNonQuery();
conn.Close();
} 展开
{
String str = "Server=.;DataBase=CommunicationSystem;User=sa;Password=521521";
SqlConnection conn = new SqlConnection(str);
conn.Open();
SqlCommand comm = new SqlCommand("insert into UserInfo values ('"+userName
+"','"+userPassword+"','"+userQuestion+"','"+userAnswer+"','"+userEmail+"','"+registerTime+"')", conn);
comm.ExecuteNonQuery();
conn.Close();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询