第一次用sql做数据库,不知道这个问题的原因,请帮忙!
<!--#include file="conn.inc"-->
<%
if not isempty(request.Form("a1")) then
ch=request.Form("ch")
ylf=request.Form("ylf")
sf=request.Form("sf")
glf=request.Form("glf")
chyyzzj=request.Form("chyyzzj")
yp=request.Form("yp")
hfy=request.Form("hfy")
qt=request.Form("qt")
conn.execute "insert into jcxx(ch,ylf,sf,glf,chyyzzj,yp,hfy,qt)
values('"&ch&"','"&ylf&"','"&sf&"','"&glf&"','"&chyyzzj&"','"& yp &"','"& hfy &"','"&qt&"')"
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script id=clienteventhandlersjs language="JavaScript">
<!--
function ylf_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
function sf_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
function glf_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
function zj_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
function yp_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
function hfy_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
function qt_onkeypress(){
var passflag
passflag=true
if (window.event.keycode<48 ||window.event.keycode>57)
{
passflag=false
}
if(window.event.keycode==46)
{
passflag=true
}
return passflag
}
//-->
</script>
</head>
<body>
<form method="post" action="add.asp">
<table width="75%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"><div align="center"><% response.write TheMessage %></div></td>
</tr>
<tr>
<td width="15%"><div align="right">车号</div></td>
<td width="28%"><input name="ch" type="text" id="ch"></td>
<td width="18%"><div align="right">租金</div></td>
<td width="39%"><input name="chyyzzj" type="text" id="chyyzzj" language=javascript onKeyPress="return
chyyzzj_onkeypress()">
元</td>
</tr>
<tr>
<td><div align="right">养路费</div></td>
<td><input name="ylf" type="text" id="ylf" language=javascript onkeypress="return ylf_onkeypress()">
元</td>
<td><div align="right">月票</div></td>
<td><input name="yp" type="text" id="yp" language=javascript onkeypress="return yp_onkeypress()">
元</td>
</tr>
<tr>
<td><div align="right">税费</div></td>
<td><input name="sf" type="text" id="sf" language=javascript onkeypress="return sf_onkeypress()">
元</td>
<td><div align="right">还费用</div></td>
<td><input name="hfy" type="text" id="hfy" language=javascript onkeypress="return hfy_onkeypress()">
元</td>
</tr>
<tr>
<td><div align="right">管理费</div></td>
<td><input name="glf" type="text" id="glf" language=javascript onkeypress="return glf_onkeypress()">
元</td>
<td><div align="right">其他</div></td>
<td><input name="qt" type="text" id="qt" language=javascript onkeypress="return qt_onkeypress()">
元</td>
</tr>
<tr>
<td colspan="2">
<input name="a1" type="submit" id="a1" value="确定" ></td>
<td colspan="2">
<input name="a2" type="submit" id="a2" value="提交" onClick="javascript:form1.reset()"></td>
</tr>
</table>
<p> </p></form>
</body>
</html>
<script language="VBScript">
<!--
function isnum()
isnum=false
if isnumeric(form1.ylf.value) then
isnum=true
end if
if isnumeric(form1.sf.value) then
isnum=true
end if
if isnumeric(form1.glf.value) then
isnum=true
end if
if isnumeric(form1.zj.value) then
isnum=true
end if
if isnumeric(form1.yp.value) then
isnum=true
end if
if isnumeric(form1.hfy.value) then
isnum=true
end if
if isnumeric(form1.qt.value) then
isnum=true
end if
if isnum=false then
msgbox"请检查输入的数据类型是否是数字!"
end if
end function
//-->
</script>
Microsoft][ODBC SQL Server Driver][SQL Server]不允许从数据类型 varchar 到数据类型 money 的隐性转换(表 'YH.dbo.jcxx',列 'ylf')。请使用 CONVERT 函数来运行此查询。
问题点数:20、回复次数:2Top
1 楼skyboy0720(曲终人散)回复于 2004-05-03 19:21:01 得分 10
你ylf里的值是什么Top
2 楼liuyangxuan(阿轩)回复于 2004-05-03 19:28:51 得分 10
将数据库里的money型字段改成varchar即可!
因为您的SQL语句是以字符型插入的,而你的库字段是money型
所以提示不允许隐性转换。Top




