If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > strsql problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-05, 17:53
jrperk jrperk is offline
Registered User
 
Join Date: Feb 2005
Posts: 1
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?
Reply With Quote
  #2 (permalink)  
Old 02-18-05, 19:41
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 20,000
the closing parenthesis after VALUES seems to be missing

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On