|
 |
asp_databases thread: Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
Message #1 by jenifer@c... on Thu, 17 Aug 2000 20:19:24
|
|
I've copied this update from CH 10 of the ASP Databases book and still
haven't got it to work with my database. WROX rep said to try posting it
here for help. I know the connection is ok. Thanks for any tips.
This is the error:
Building and Executing An Update Statement
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator)
in query expression 'RI' Where LastName = 'Jones''.
/ASPSamp/Chapter.10/patientupdate2.asp, line 205
This is a snippet of the code where the error arises:
'***********************************************************
'* Step 3: Update record
'***********************************************************
ElseIf Request.Form("FormAction") = "Step3" Then
'Build the update string
strSQL = "Update Patient_Master Set " & _
"FirstName = " & _
Cstr(Request.Form("FirstName")) & ", " & _
"Address1 = " & _
Cstr(Request.Form("Address1")) & ", " & _
"Address2 = " & _
Cstr(Request.Form("Address2")) & ", " & _
"City = " & _
Cstr(Request.Form("City")) & ", " & _
"State = " & _
Cstr(Request.Form("State")) & "' " & _
"Where LastName = '" & _
Cstr(Request.Form("LastName")) & "'"
'Create and open the database object
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=neurohealth"
'Create the command object
Set objCmd = Server.CreateObject("ADODB.Command")
'Set the command object properties
Set objCmd.ActiveConnection = objConn
objCmd.CommandText = strSQL
objCmd.CommandType = adCmdText
'Execute the command
objCmd.execute strSQL, 1
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 21 Aug 2000 10:51:33 +1000
|
|
http://www.adopenstatic.com/FAQ/80040e14.asp under Scenario 3
looks like you need the function to replace single/double quotes in form
input.
Cheers
Ken
----- Original Message -----
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, August 17, 2000 8:19 PM
Subject: [asp_databases] Microsoft OLE DB Provider for ODBC Drivers error
'80040e14'
> I've copied this update from CH 10 of the ASP Databases book and still
> haven't got it to work with my database. WROX rep said to try posting it
> here for help. I know the connection is ok. Thanks for any tips.
>
> This is the error:
>
> Building and Executing An Update Statement
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator)
> in query expression 'RI' Where LastName = 'Jones''.
>
> /ASPSamp/Chapter.10/patientupdate2.asp, line 205
>
> This is a snippet of the code where the error arises:
>
> '***********************************************************
> '* Step 3: Update record
> '***********************************************************
> ElseIf Request.Form("FormAction") = "Step3" Then
>
> 'Build the update string
> strSQL = "Update Patient_Master Set " & _
> "FirstName = " & _
> Cstr(Request.Form("FirstName")) & ", " & _
> "Address1 = " & _
> Cstr(Request.Form("Address1")) & ", " & _
> "Address2 = " & _
> Cstr(Request.Form("Address2")) & ", " & _
> "City = " & _
> Cstr(Request.Form("City")) & ", " & _
> "State = " & _
> Cstr(Request.Form("State")) & "' " & _
> "Where LastName = '" & _
> Cstr(Request.Form("LastName")) & "'"
>
> 'Create and open the database object
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open "DSN=neurohealth"
>
> 'Create the command object
> Set objCmd = Server.CreateObject("ADODB.Command")
>
> 'Set the command object properties
> Set objCmd.ActiveConnection = objConn
> objCmd.CommandText = strSQL
> objCmd.CommandType = adCmdText
>
> 'Execute the command
> objCmd.execute strSQL, 1
>
Message #3 by gbrown@c... on Mon, 21 Aug 2000 19:37:6
|
|
Hi
I've not run your code but it looks like you're missing the set clause
ie Update table set field1='value'
as in
Set objconn = Server.CreateObject("ADODB.Command")
objConn.commandtext="Update rbvMas " & "set make='" & request("make") &
"'" & " where vid='" & request("ovid") & "';"
objConn.Commandtype=adCmdText
objConn.ActiveConnection= "Driver={Microsoft Visual FoxPro
Driver};SourceType=DBC;SourceDb=C:\Fleet\database.dbc"
objConn.execute noRecs
Okay ?
Regards
gbrown@c...
Message #4 by "Julie" <julieqbert@a...> on Wed, 23 Aug 2000 20:24:52
|
|
I get this message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query
expression 'EquipID=7and StartTime>=##'.
/internal/equipschedule/includes/Funcs.inc, line 123
The code is this:
'Calculates max slots available for a meeting time
Function CalcMaxSlots(ReqDate,EquipID)
dim cConn,rsSched
dim EndOfDay,NextTime
dim MinsAvail,SlotsAvail
EndOfDay=cdate(DateValue(ReqDate) & " 17:00")
'Get time of next meeting
Set cConn=ConnectServer()
Set rsSched = Server.CreateObject("ADODB.Recordset")
rsSched.MaxRecords=1 'Only need the first one
**************************************************************************
Sql="select StartTime From reservation Where EquipID=" & EquipID & "and
StartTime>=#" & ReqTime & "# order by StartTime"
rsSched.open Sql,cConn,adOpenStatic,adLockReadOnly,adCmdText
**************************************************************************
If rsSched.EOF then
NextTime=EndOfDay
else
NextTime=rsSched("StartTime").value
End IF
If NextTime>EndOfDay then NextTime=EndOfDay
rsSched.Close
'Make sure there is not a meeting in progress at the desired time
Sql="select StartTime,EndTime From reservation Where EquipID=" & EquipID &
" and StartTime<=#" & ReqTime & "# and EndTime>#" & ReqTime & "# order by
StartTime"
rsSched.open Sql,cConn,adOpenStatic,adLockReadOnly,adCmdText
If not rsSched.EOF then
'Meeting in progress
SlotsAvail=0
else
'Calc slots available based on next meeting time
MinsAvail=datediff("n",ReqTime,NextTime)
SlotsAvail=MinsAvail\TimeInterval
If NextTime=EndOfDay then
'Allow meeting to run past "End Of Day"
SlotsAvail=SlotsAvail+(180\TimeInterval)
End If
End If
Set rsSched=Nothing
cConn.Close
Set cConn=Nothing
CalcMaxSlots=SlotsAvail
End Function
I have place astricks around the problem. I have another web site with the
same exact code just different names and a different database. The other
web site seems to work just fine but for some crazy reason this just does
not want to work. I have been struggling with this problem for about a
month and I have come to my wicks end. If anyone could please help me I
would appreciate any suggestions.
Thank You,
Julie
Message #5 by smartin@c... on Wed, 23 Aug 2000 16:17:14 -0400
|
|
Where does the value "ReqTime" come from? I see ReqDate being passed to the
function, but no ReqTime anywhere but the SQL statement (where you're
encountering the problem because it looks like ReqTime has no value--the
quoted part of the SQL statement in the error doesn't have any value between
the ##s).
-Stephen
> -----Original Message-----
> From: Julie
> Sent: Wednesday, August 23, 2000 4:25 PM
> To: ASP Databases
> Subject: [asp_databases] Microsoft OLE DB Provider for ODBC Drivers
> error '80040e14'
>
>
> I get this message:
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in
> date in query
> expression 'EquipID=7and StartTime>=##'.
>
> /internal/equipschedule/includes/Funcs.inc, line 123
>
> The code is this:
>
> 'Calculates max slots available for a meeting time
> Function CalcMaxSlots(ReqDate,EquipID)
> dim cConn,rsSched
> dim EndOfDay,NextTime
> dim MinsAvail,SlotsAvail
>
>
> EndOfDay=cdate(DateValue(ReqDate) & " 17:00")
>
>
> 'Get time of next meeting
>
> Set cConn=ConnectServer()
> Set rsSched = Server.CreateObject("ADODB.Recordset")
> rsSched.MaxRecords=1 'Only need the first one
> **************************************************************
> ************
> Sql="select StartTime From reservation Where EquipID="
> & EquipID & "and
> StartTime>=#" & ReqTime & "# order by StartTime"
> rsSched.open Sql,cConn,adOpenStatic,adLockReadOnly,adCmdText
> **************************************************************
> ************
> If rsSched.EOF then
> NextTime=EndOfDay
> else
> NextTime=rsSched("StartTime").value
> End IF
> If NextTime>EndOfDay then NextTime=EndOfDay
>
> rsSched.Close
>
> 'Make sure there is not a meeting in progress at the
> desired time
>
> Sql="select StartTime,EndTime From reservation Where
> EquipID=" & EquipID &
> " and StartTime<=#" & ReqTime & "# and EndTime>#" & ReqTime &
> "# order by
> StartTime"
> rsSched.open Sql,cConn,adOpenStatic,adLockReadOnly,adCmdText
>
> If not rsSched.EOF then
> 'Meeting in progress
> SlotsAvail=0
> else
> 'Calc slots available based on next meeting time
>
> MinsAvail=datediff("n",ReqTime,NextTime)
> SlotsAvail=MinsAvail\TimeInterval
>
> If NextTime=EndOfDay then
> 'Allow meeting to run past "End Of Day"
> SlotsAvail=SlotsAvail+(180\TimeInterval)
> End If
> End If
>
> Set rsSched=Nothing
> cConn.Close
> Set cConn=Nothing
>
> CalcMaxSlots=SlotsAvail
> End Function
>
>
> I have place astricks around the problem. I have another web
> site with the
> same exact code just different names and a different
> database. The other
> web site seems to work just fine but for some crazy reason
> this just does
> not want to work. I have been struggling with this problem
> for about a
> month and I have come to my wicks end. If anyone could
> please help me I
> would appreciate any suggestions.
>
> Thank You,
> Julie
>
|
|
 |