Notices

Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: error in insert query

Results 1 to 3 of 3
Share This Thread →
  1. #1
    salman.pirani is offline Registered User
    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
    gk53's Avatar
    gk53 is offline Contributing User
    Join Date
    Mar 2005
    Location
    Columbus, OH
    Posts
    1,538
    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

  3. #3
    BLarche is offline Contributing User
    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."

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

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

ASP Free Advertisers and Affiliates