p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Classic ASP Databases (http://p2p.wrox.com/forumdisplay.php?f=62)
-   -   error message displays (http://p2p.wrox.com/showthread.php?t=31259)

p2ptolu July 7th, 2005 04:27 AM

error message displays
 
I used an APPEND QUERY in access and upsived to SQL server 7, but i had to host on SQL Server 2000, my append query was not created so i used the codes below to create a stored procedure and it displays an error under the query, please how do i solve this issue.

INSERT INTO AuditUpdate ( TypeId, ElementSectionId, ElementTypeId, ElementId, ElementTitle, UserId, TimeUpdate )
VALUES ([TypeId], [ElementSectionId], [ElementTypeId], [ElementId], [ElementTitle], [UserId], CDate([TimeUpdate]));


ERROR :
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ','.

/cms/siteeditors/CmsUserAddEditFn.asp, line 51



CODE BELOW :

<%
    'get form data
    intId = Replace(Request.form("id"), "'", "''")
    intTypeId = Replace(Request.form("TypeId"), "'", "''")
    strUsername = Replace(Request.form("Username"), "'", "''")
    strPassword = Replace(Request.form("Password"), "'", "''")
    strEmailAddress = Replace(Request.form("EmailAddress"), "'", "''")

    'validate form data
    if not Isnumeric(intId) then intId = 0 'set id to impossible id no so recordset returns eof
    if not IsNumeric(intTypeId) or strUsername = "" or (intId = 0 and strPassword = "") then
        session("msg") = "Error! <i>Invalid or missing data."
        response.Redirect "../main/msg.asp"
    end if

    'open data sources
    Set oConn = Server.CreateObject("ADODB.Connection")
    'oConn.open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("..\..\db\db.mdb")
    oConn.Open application("dbaseConn")
    Set oRset = Server.CreateObject("ADODB.Recordset")
    strSql = "SELECT * FROM Editors WHERE Id = " & intId
    oRset.Open strSql, oConn, adOpenStatic, adLockOptimistic

    'add/edit data
    strUpdateType = "edited"
    intUpdateType = 2
    if oRset.eof then
        oRset.AddNew
        strUpdateType = "added"
        intUpdateType = 1
    end if

    oRset("TypeId") = intTypeId
    oRset("UserName") = strUsername
    if not ((intUpdateType = 2) and (strPassword = "")) then oRset("Password") = strPassword
    oRset("EmailAddress") = strEmailAddress

    oRset.Update

    'get Id of new or added item
    intId = oRset("id")
    oRset.Close

    '-----update audit records - TypeId, ElementTypeId, ElementId, ElementTitle, EditorId, TimeUpdate
    strSql = "qryAuditUpdateAdd" & intUpdateType & ", 1, "& intId & ", '" & strUsername & "'," & CInt (session("UserId")) & ", " & CDbl(Now)
    oConn.Execute strSql

    'close data sources
    oConn.Close
    set oRset=nothing
    set oConn=nothing

    'display results
    session("msg") = "Success! <i>CMS User " & strUpdateType & ".</i>"
    session("submenu") = "cmsuser"
    response.Redirect "../main/msg.asp"
%>




All times are GMT -4. The time now is 08:24 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.