在线工具 在线编程 在线白板 在线工具 在线编程 在线白板

[Microsoft][ODBC SQL Server Driver][SQL Server]将数据类型 varchar 转换为 bigint 时出错。

提示错误:Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07'

[Microsoft][ODBC SQL Server Driver][SQL Server]将数据类型 varchar 转换为 bigint 时出错。

/hou/hy_mod.asp,行 13
代码是:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/data.asp" -->
<!--#include file="inchou/all_inchou_top.asp" -->
<%
Dim rs_hy
Dim rs_hy_numRows
Set rs_hy = Server.CreateObject("ADODB.Recordset")
rs_hy.ActiveConnection = MM_data_STRING
rs_hy.Source = "SELECT * FROM tb_hy WHERE id_hy='"&request.QueryString("id")&"'"
rs_hy.CursorType = 0
rs_hy.CursorLocation = 2
rs_hy.LockType = 1
rs_hy.Open()
rs_hy_numRows = 0
%>
<form id="formh1" name="formh1" method="post" action="hy_h1xadd.asp?hyid=<%=(rs_hy.Fields.Item("id_hy").Value)%>&hycname=<%=(rs_hy.Fields.Item("cname_hy").Value)%>">

<td height="25" align="center">

<select name="dd1">
<%
Dim rs_h1
Dim rs_h1_numRows
Set rs_h1 = Server.CreateObject("ADODB.Recordset")
rs_h1.ActiveConnection = MM_data_STRING
rs_h1.Source = "SELECT * FROM tb_h1 ORDER BY xu_h1 ASC"
rs_h1.CursorType = 0
rs_h1.CursorLocation = 2
rs_h1.LockType = 1
rs_h1.Open()
rs_h1_numRows = 0
%>
<%
Dim Repeat_h1__numRows
Dim Repeat_h1__index
Repeat_h1__numRows = -1
Repeat_h1__index = 0
rs_h1_numRows = rs_h1_numRows + Repeat_h1__numRows
%>
<%
While ((Repeat_h1__numRows <> 0) AND (NOT rs_h1.EOF))
%>

<option value="<%=(rs_h1.Fields.Item("name_h1").Value)%>"><%=(rs_h1.Fields.Item("name_h1").Value)%></option>
<%
Repeat_h1__index=Repeat_h1__index+1
Repeat_h1__numRows=Repeat_h1__numRows-1
rs_h1.MoveNext()
Wend
%>
<%
rs_h1.Close()
Set rs_h1 = Nothing
%>
</select>

  <input name="dd2" type="text" size="2" />
  <input type="submit" class="anniu" name="Submit" value="添加" style="cursor:hand;" /> </td>
</form>
最新回答
时光里

2025-03-26 09:48:32

rs_hy.Source = "SELECT * FROM tb_hy WHERE id_hy='"&request.QueryString("id")&"'"
改为:
rs_hy.Source = "SELECT * FROM tb_hy WHERE id_hy=cast("&request.QueryString("id")&" as bigint)"
追问
谢谢这位朋友,我用了您的代码后提示:Microsoft OLE DB Provider for ODBC Drivers '80040e14' 

[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '#hang' 附近有语法错误。

\hou\hy_mod.asp, line 13
追答
debug单步调试一下,看看rs_hy.Source的值是什么(也就是要执行的SQL语句),然后在SQL Server直接跑来看看。
追问
不好意思 这个我还不会呢。请问你QQ多少,我的QQ是1136352218