标准表达式中数据类型不匹配。
protectedvoidtiJiao_Click(objectsender,EventArgse){OleDbConnectionocnn=newOleDbConnec...
protected void tiJiao_Click(object sender, EventArgs e)
{
OleDbConnection ocnn = new OleDbConnection();
ocnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(".") + "\\App_Data\\hospital.mdb;Persist Security Info=False";
// try
// {
OleDbDataAdapter sqldadp = new OleDbDataAdapter("Select * From biao8 where cstr(zhuYuanHao)=0", ocnn);
OleDbCommandBuilder bb = new OleDbCommandBuilder(sqldadp);
DataSet qiangjiu = new DataSet();
sqldadp.Fill(qiangjiu);-------------------这里有错
DataRow Myrow = qiangjiu.Tables[0].NewRow();
Myrow["xingMing"] = xingMing.Text;
Myrow["xingBie"] = xingBie.Text;
Myrow["nianLing"] = nianLing.Text;
Myrow["chuangHao"] = chuangHao.Text;
Myrow["zhuYuanHao"] = zhuYuanHao.Text;
Myrow["ruYuanShiJian"] = nian.Text + "-" + yue.Text + "-" + ri.Text;
Myrow["zhenDuan"] = zhenDuan.Text;
Myrow["bingQing"] = bingQing.Text;
Myrow["qiangJiuCuoShi"] = qiangJiuCuoShi.Text;
Myrow["qiangJiuJieGuo"] = qiangJiuJieGuo.Text;
Myrow["canJiaRenYuan"] = canJiaQiangJiuRenYuan.Text;
Myrow["jiLuRen"] = jiLuRen.Text;
qiangjiu.Tables[0].Rows.Add(Myrow);
sqldadp.Update(qiangjiu);
Response.Write("operation successful!");
}
// catch { Response.Write("wrong"); }
// }
}
总是说标准表达式中数据类型不匹配。我用的是access数据库。
我把数据库中所有的类型都改成文本了也不可以。 展开
{
OleDbConnection ocnn = new OleDbConnection();
ocnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(".") + "\\App_Data\\hospital.mdb;Persist Security Info=False";
// try
// {
OleDbDataAdapter sqldadp = new OleDbDataAdapter("Select * From biao8 where cstr(zhuYuanHao)=0", ocnn);
OleDbCommandBuilder bb = new OleDbCommandBuilder(sqldadp);
DataSet qiangjiu = new DataSet();
sqldadp.Fill(qiangjiu);-------------------这里有错
DataRow Myrow = qiangjiu.Tables[0].NewRow();
Myrow["xingMing"] = xingMing.Text;
Myrow["xingBie"] = xingBie.Text;
Myrow["nianLing"] = nianLing.Text;
Myrow["chuangHao"] = chuangHao.Text;
Myrow["zhuYuanHao"] = zhuYuanHao.Text;
Myrow["ruYuanShiJian"] = nian.Text + "-" + yue.Text + "-" + ri.Text;
Myrow["zhenDuan"] = zhenDuan.Text;
Myrow["bingQing"] = bingQing.Text;
Myrow["qiangJiuCuoShi"] = qiangJiuCuoShi.Text;
Myrow["qiangJiuJieGuo"] = qiangJiuJieGuo.Text;
Myrow["canJiaRenYuan"] = canJiaQiangJiuRenYuan.Text;
Myrow["jiLuRen"] = jiLuRen.Text;
qiangjiu.Tables[0].Rows.Add(Myrow);
sqldadp.Update(qiangjiu);
Response.Write("operation successful!");
}
// catch { Response.Write("wrong"); }
// }
}
总是说标准表达式中数据类型不匹配。我用的是access数据库。
我把数据库中所有的类型都改成文本了也不可以。 展开
展开全部
首先,我置疑你在数据库中存在pass又存在pass1的这种做法,pass1的存在仅仅是为了检查用户输入,何必给它在数据库中留一席之地?
其次,response.End并不会中止程序的运行,只是中止对客户端的输出而已,你要保证程序不出错误,必须这样写showmessage:
<%
sub
showmessage(message)
response.Write"<center><h3>"&message&"</h3>"
response.Write"<a
href=Add.asp>返回上一页</a></center>"
response.End
checkfail="yes"
end
sub
%>
在程序首部用Dim
checkfail定义。
然后把你对数据库操作的语句全部用这个包起来:
If
checkfail<>"yes"
Then
End
If
然后再试试看!
其次,response.End并不会中止程序的运行,只是中止对客户端的输出而已,你要保证程序不出错误,必须这样写showmessage:
<%
sub
showmessage(message)
response.Write"<center><h3>"&message&"</h3>"
response.Write"<a
href=Add.asp>返回上一页</a></center>"
response.End
checkfail="yes"
end
sub
%>
在程序首部用Dim
checkfail定义。
然后把你对数据库操作的语句全部用这个包起来:
If
checkfail<>"yes"
Then
End
If
然后再试试看!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询