Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    8

    Unanswered: inserting not working, but no errors

    I am trying to insert some data from my asp but am having no luck. I am using Access 2002 and I have succesfuuly queried the database with a select statement from my asp.

    I know the insert statement works because I have run it directly on Access. However, whenever I run it from my asp, I get a blank screen returned; afterehich, when I query the DB to see if the row was inserted. It is not there...Please help!

    Here is my code..
    ----------------
    'Get next sequencial value from db
    sSql = "select max(testimonial_id)+1 as nexval from testimonials"
    objcmd.CommandText = sSql
    set rs = objcmd.Execute
    nexval = rs.Fields("nexval").Value
    set cmd = nothing

    sSql = "insert into testimonials values(6, 'test6th@home.com', 'test', 0)"
    objcmd.Execute
    ---------------
    it is acting as if the second objcmd.execute is never executing

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    im assuming that you are setting the objcmd (not cmd) to nothing in the bolded line below??? if you are setting objcmd to nothing, then you can't possibly execute the insert command.
    Code:
    'Get next sequencial value from db
    sSql = "select max(testimonial_id)+1 as nexval from testimonials"
    objcmd.CommandText = sSql
    set rs = objcmd.Execute 
    nexval = rs.Fields("nexval").Value 
    set cmd = nothing 
    
    sSql = "insert into testimonials values(6, 'test6th@home.com', 'test', 0)"
    objcmd.Execute
    it should be something like this
    Code:
    'Get next sequencial value from db
    sSql = "select max(testimonial_id)+1 as nexval from testimonials"
    objcmd.CommandText = sSql
    set rs = objcmd.Execute 
    nexval = rs.Fields("nexval").Value 
    
    
    sSql1 = "insert into testimonials values(6, 'test6th@home.com', 'test', 0)"
    objcmd.CommandText = sSql1
    objcmd.Execute 
    
    set objcmd = nothing
    Last edited by Memnoch1207; 08-11-03 at 03:58.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •