\"Microsoft VBScript runtime error '800a000d&#

2019-07-04 16:26发布

问题:

I have the next code, which works as follows:

  1. Receive some parameters from an url
  2. Insert this data into a table called clients
  3. Then I select the last data introduced in the clients table
  4. At last, it tries to insert this data into another table called users.

But I'm getting this error:

"Microsoft VBScript runtime error '800a000d' '800a000d'

Type mismatch: '[string: "INSERT INTO galileo."]'

/createClient.asp, line 50

The line 50 is this one:

 <%
    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()
    %>

And this is the full code:

    <%@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")%>

回答1:

You are missing a ')' after the last ' in your SQL string. But I am not sure why you get this kind of error message though.