#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    error in insert query


    ear sir

    db is corect query is corect i dnt knw whr is the error

    out put
    G:\wwwroot2\hr\tform\admin\webdata\course.mdbError code -2147467259INSERT INTO course (pt,course_owner,training_cordinator) VALUES ('sss','w','w')
    Code:
    <%
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.MapPath("webdata/course.mdb"))
    response.Write(Server.MapPath("webdata/course.mdb"))
    sql="INSERT INTO course (pt,course_owner,"
    sql=sql & "training_cordinator)"
    sql=sql & " VALUES "
    sql=sql & "('" & Request.Form("pt") & "',"
    sql=sql & "'" & Request.Form("course_owner") & "',"
    sql=sql & "'" & Request.Form("training_coo") & "')"
    
    
        on error resume next
    conn.Execute sql,recaffected
    if err<>0 then
        Response.Write("Error code " & err)
    else
       Response.Write("<h3> Programme Title has been created</h3>")
    end if
    response.Write(sql)
    
      conn.close
    %>
  2. #2
  3. Contributing User
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,581
    Rep Power
    278
    I guess you have access database file and file already open exclusively by another user... so it is locked for any updates by another connection...
    GK
    __________________________________________________ _____
    if you found this post is useful click Give Rep button (bottom side on this reply ) and agree
  4. #3
  5. No Profile Picture
    Contributing User
    ASP High Scholar (3500 - 3999 posts)

    Join Date
    Jan 2007
    Location
    Indianapolis, USA
    Posts
    3,559
    Rep Power
    697
    You can clean up your SQL too:

    Code:
    strSQL = "INSERT INTO Course (pt, course_owner, training_coordinator) VALUES (" & _
    	"'" & Request.Form("pt") & "'," & _
    	"'" & Request.Form("course_owner") & "'," & _
    	"'" & Request.Form("training_coo") & "'" & _
    	")"
    "You'll never be as perfect as BLaaaaaaaaarche."

Similar Threads

  1. Insert query error in ASp.net
    By rambok4 in forum .NET Development
    Replies: 5
    Last Post: May 10th, 2010, 08:25 AM
  2. Insert query Syntax error
    By alihammad in forum ASP Development
    Replies: 4
    Last Post: May 26th, 2008, 04:14 AM
  3. Insert Query error
    By Salman8506 in forum ASP Development
    Replies: 1
    Last Post: June 20th, 2007, 01:49 AM
  4. Insert SQL Query error
    By zwieback89 in forum ASP Development
    Replies: 4
    Last Post: May 22nd, 2007, 02:57 PM
  5. insert query error
    By newb!e in forum Microsoft SQL Server
    Replies: 6
    Last Post: May 17th, 2005, 10:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo