View Single Post
  #1 (permalink)  
Old July 7th, 2005, 04:27 AM
p2ptolu p2ptolu is offline
Authorized User
 
Join Date: Jan 2005
Location: ipaja, lagos, Nigeria.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to p2ptolu Send a message via Yahoo to p2ptolu
Default 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"
%>


Reply With Quote