3

我有下一个代码,其工作原理如下:

  1. 从 url 接收一些参数
  2. 将此数据插入名为 clients 的表中
  3. 然后我选择clients表中最后引入的数据
  4. 最后,它尝试将此数据插入另一个名为 users 的表中。

但我收到了这个错误:

“Microsoft VBScript 运行时错误‘800a000d’‘800a000d’

类型不匹配:'[string: "INSERT INTO galileo."]'

/createClient.asp,第 50 行

第 50 行是这一行:

 <%
    Dim insertaUsuario
    Set insertaUsuario = Server.CreateObject("ADODB.Recordset")
    insertaUsuario.ActiveConnection = MM_trucks_STRING
    '" + Replace(posicionFechaFin__MMColParam, "'", "''") + "'
    insertaUsuario.Source = "INSERT INTO galileo.users (email,password,clientid) values ('"+(selecciona.Fields.Item("email").Value)+"','"+(selecciona.Fields.Item("password").Value)+"', '" + (selecciona.Fields.Item("id").Value)+ "'"
    insertaUsuario.Open()
    %>

这是完整的代码:

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <!--#include file="connects/global.asp" -->
    <%
    Dim inserta__MMColParamEmail
    inserta__MMColParamEmail = "1"
    If (Request.QueryString("email") <> "") Then 
      inserta__MMColParamEmail = Request.QueryString("email")
    End If
    %>
    <%
    Dim inserta__MMColParamPassword
    inserta__MMColParamPasswordd = "1"
    If (Request.QueryString("password") <> "") Then 
      inserta__MMColParamPassword = Request.QueryString("password")
    End If
    %>

    <%
    Dim inserta
    Set inserta = Server.CreateObject("ADODB.Recordset")
    inserta.ActiveConnection = MM_trucks_STRING
    '" + Replace(posicionFechaFin__MMColParam, "'", "''") + "'
    inserta.Source = "INSERT INTO galileo.clients (email,password) values ('" + Replace(inserta__MMColParamEmail, "'", "''") + "','" + Replace(inserta__MMColParamPassword, "'", "''") + "')"
    inserta.Open()
    %>
    <%

    Dim selecciona
    Dim selecciona_numRows

    Set selecciona = Server.CreateObject("ADODB.Recordset")
    selecciona.ActiveConnection = MM_trucks_STRING
    selecciona.Source = "SELECT id, email, password from clients where email='" + Replace(inserta__MMColParamEmail, "'", "''") + "' and password='" + Replace(inserta__MMColParamPassword, "'", "''") + "'"
    selecciona.CursorType = 0
    selecciona.CursorLocation = 2
    selecciona.LockType = 1
    selecciona.Open()

    selecciona_numRows = 0
    %>
    <%= (selecciona.Fields.Item("id").Value)%>, <%= (selecciona.Fields.Item("email").Value) %>, <%= (selecciona.Fields.Item("password").Value) %>


    <%
    Dim insertaUsuario
    Set insertaUsuario = Server.CreateObject("ADODB.Recordset")
    insertaUsuario.ActiveConnection = MM_trucks_STRING
    '" + Replace(posicionFechaFin__MMColParam, "'", "''") + "'
    insertaUsuario.Source = "INSERT INTO galileo.users (email,password,clientid) values ('"+(selecciona.Fields.Item("email").Value)+"','"+(selecciona.Fields.Item("password").Value)+"', '" + (selecciona.Fields.Item("id").Value)+ "'"
    insertaUsuario.Open()
    %>

    <!--If it is all ok, it redirects-->
    <% Response.redirect ("default.asp")%>
4

1 回答 1

4

您在 SQL 字符串中的最后一个 ' 之后缺少一个 ')'。但是我不确定您为什么会收到这种错误消息。

于 2013-03-17T19:55:41.180 回答