Results 1 to 2 of 2

Thread: strsql problem

  1. #1
    Join Date
    Feb 2005
    Posts
    1

    Unanswered: strsql problem

    getting.......
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ''.
    /forum/testdatabase.asp, line 17

    from this page
    <%
    Function ChkString(string)
    if string = "" then string = " "
    ChkString = Replace(string, "'", "''")
    End Function

    set my_conn= Server.CreateObject("ADODB.Connection")
    my_conn.Open "DRIVER={SQL Server};SERVER=lsu-msmc; DATABASE=forums;"

    StrSql= "Select * from RecordOfRequest where name = '" & Request("view_name") & "'"
    set rs = my_conn.Execute (StrSql)

    if rs.BOF or rs.EOF then ' No records found. i.e. New record
    StrSql = "INSERT INTO RecordOfRequest (name) values ('" & Request("view_name") & "'"
    End If

    my_conn.Execute (strSql)

    my_Conn.Close
    set my_conn = nothing

    Response.Redirect ("RecordOfRequest.asp?view_name=" & request("view_name"))

    %>

    what am i doing wrong?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    the closing parenthesis after VALUES seems to be missing

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •