简体   繁体   English

SQL Server错误80040e14在结果集中使用经典ASP

[英]SQL Server error 80040e14 Using Classic ASP in a Result Set

I'm trying to select results from a database for each position of a vector using classic ASP and SQL Server. 我正在尝试使用经典的ASP和SQL Server从数据库中为矢量的每个位置选择结果。 The code so far: 到目前为止的代码:

FOR EACH x IN Tabela

    sql = "SELECT DISTINCT tborders.family AS family, tborders.qty AS qty, tborders.los AS los, CONVERT(DATE, tborders.mrd_date) AS mrd FROM [DASH].[dashboard_db].[dbo].[tb_family] AS tbfamily INNER JOIN [DASH].[dashboard_db].[dbo].[tb_started_zero] AS tborders ON tbfamily.[family] = tborders.[family] WHERE tborders.[Order Number] = "&x&""
    SET rs = conn.execute(sql)

    IF rs.EOF = false THEN
        mrd(counter) = rs("mrd") 
        family(counter) = rs("family") 
        los(counter) = rs("los") 
        qty(counter) = rs("qty") 
        counter=counter+1
    END IF

NEXT

Taking note that tborders.[Order Number] is a int typed value. 请注意, tborders.[Order Number]是一个int类型的值。 For some reason I'm having this error: 由于某种原因,我遇到了这个错误:

Microsoft SQL Server Native Client 11.0 error '80040e14' Microsoft SQL Server本机客户端11.0错误'80040e14'

Incorrect syntax near '='. '='附近的语法不正确。

/asplearning/act/validate-schedule-line.asp, line 46 /asplearning/act/validate-schedule-line.asp,第46行

I have tried removing the SET , but then my result set isn't recognized as a object. 我尝试删除SET ,但随后我的结果集未被识别为对象。 I'm pretty sure that the types are just fine, I have tried: 我已经确定类型很好,我已经尝试过:

if isNumeric(x) THEN
        response.write("<h1>it is numeric</h1>")
        else
        response.write("<h1>not numeric</h1>")
    end if

And it has written "it is numeric" for each position of Tabela . 它为Tabela每个位置都写了“它是数字”。 Can anyone help with what it seems to be the problem? 任何人都可以解决似乎存在的问题吗?

It's look you have an empty item (first or last item of the collection). 看起来您有一个空项目(集合的第一个或最后一个项目)。

I strongly suggest you to use sp_executesql. 我强烈建议您使用sp_executesql。 This will use a compiled execution plan, and this will validate your parameters (against sql injection). 这将使用编译的执行计划,并且将验证您的参数(针对sql注入)。

FOR EACH x IN Tabela
    if len(x) > 0 then
        sql = "exec sp_executeSql N'SELECT DISTINCT tborders.family AS family, tborders.qty AS qty, tborders.los AS los, CONVERT(DATE, tborders.mrd_date) AS mrd FROM [DASH].[dashboard_db].[dbo].[tb_family] AS tbfamily INNER JOIN [DASH].[dashboard_db].[dbo].[tb_started_zero] AS tborders ON tbfamily.[family] = tborders.[family] WHERE tborders.[Order Number] = @OrderNumber', N'@OrderNumber int', @orderNumber = " & x
        SET rs = conn.execute(sql)

        IF rs.EOF = false THEN
            mrd(counter) = rs("mrd") 
            family(counter) = rs("family") 
            los(counter) = rs("los") 
            qty(counter) = rs("qty") 
            counter=counter+1
        END IF
        rs.close
    end if
NEXT

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL Server错误&#39;80040e14&#39;列名不明确 - SQL Server error '80040e14' Ambiguous column name SQL Server 2012 上的 SQL Server 错误“80040e14”语法不正确 - SQL Server error '80040e14' incorrect syntax on SQL Server 2012 SQL Server的Microsoft OLE DB提供程序错误&#39;80040e14&#39;无效的列名。 SQL查询 - Microsoft OLE DB Provider for SQL Server error '80040e14' Invalid column name . SQL query 尝试使用VBA从SQL Server检索数据时出现运行时错误&#39;-2147217900(80040e14) - Run-time error '-2147217900 (80040e14) while trying to retrieving data from SQL Server using VBA 尝试从 SQL Server 检索数据时出现 VBA ADODB 错误 (80040e14) - VBA ADODB error (80040e14) when trying to retrieve data from SQL Server 用于SQL Server的Microsoft OLE DB提供程序错误“80040e14”'='附近的语法不正确 - Microsoft OLE DB Provider for SQL Server error '80040e14' Incorrect syntax near '=' 无法使用VBA连接到SQL Server(运行时错误(80040e14)) - Cannot connect to sql server with VBA (Run-time error (80040e14)) Microsoft OLE DB提供程序的SQL Server错误&#39;80040e14&#39;找不到存储的过程 - Microsoft OLE DB Provider for SQL Server error '80040e14' Could not find stored procedure Microsoft OLE DB提供程序的SQL Server错误&#39;80040e14&#39; - Microsoft OLE DB Provider for SQL Server error '80040e14' 运行时错误“-2147217900 (80040e14)”:“1”附近的语法不正确 - Run-time error' -2147217900 (80040e14)': Incorrect syntax near '1'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM