数据库有记录但是,提示错误 存储数据错误正在中止线程。
protected void Button1_Click(object sender, EventArgs e)
{
try
{ string employee1 = Convert.ToString(Session["name"]);
string employee2 = HttpUtility.UrlDecode(Request.QueryString["name2"]); string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" + HttpContext.Current.Server.MapPath(@"~/minisurvey_360/#db.mdb");
OleDbConnection con = new OleDbConnection(strCon);
con.Open();
string strsql = "insert into qa1(q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13,q14,q15,q16,q17,q18,q19,q20,q21,q22,q23,q24,q25,q26,q27,employee1,employee2) values(";
strsql += "'" + RadioButtonList1.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList2.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList3.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList4.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList5.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList6.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList7.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList8.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList9.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList10.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList11.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList12.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList13.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList14.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList15.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList16.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList17.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList18.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList19.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList20.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList21.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList22.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList23.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList24.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList25.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList26.SelectedItem.Text.ToString() + "'";
strsql += ",'" + RadioButtonList27.SelectedItem.Text.ToString() + "'";
strsql += ",'" + employee1 + "'";
strsql += ",'" + employee2 + "')";
OleDbCommand cmd = new OleDbCommand(strsql, con);
cmd.ExecuteNonQuery();
cmd.Dispose();
con.Close();
Response.Redirect("Default.aspx");
}
catch (Exception ex)
{ throw new Exception("存储数据错误" + ex.Message);
}
}
}
解决方案 »
- 怎么使用ajaxpro.dll显示"载入中...."
- EXCEL导入SQL
- 求正则表达式。在线等
- 用JS,还是用服务器端,代码!
- RadiobuttonList显示文字疑问
- ~散100分~并问几个关于建立网站的问题!
- excel导出问题
- 我发布网站到web空间中,怎么会出现这样的错误,急啊~~~
- 怎么才能用string内的split方法分开下面的路径:
- (asp.net)急急急,在线等。请问一下各位,我这个定时生成的gobal.asax.cs文件在本机可以生成文件,放到IIS服务于服务器上就不行了
- URL无故多出(S(phfvfhzrouh2ib45ubeyvw55))这段东西。看看
- 谁知道Web QQ的聊天窗口是怎么做的
检查Response.Redirect("Default.aspx");