troubleshooting Question

Cannot get objConn.execute sql to insert into database

Avatar of pborregg
pborreggFlag for United States of America asked on
VB ScriptMicrosoft SQL Server 2005
6 Comments1 Solution504 ViewsLast Modified:
Here's my problem... I have an insert statement within a LOOP... it works in other code I have but this peice of code (INSERT INTO ONLY) doesn't work....

everything before the INSERT INTO statement and AFTER works PERFECTLY!!!!

I just can't get the sqlXfer(i) to INSERT. I've uncommented out the Response.Write and viewed the SQL Statement for validity and it's formed correctly and even works in Enterprise Manager ISQL window.

Any thoughts please???

-------------------------------
for i = 1 to intRecCnt
                  
      'Get the records to be transferred FIRST ISSUES
      sqlA(i) = "SELECT ir_name, ir_desc, ir_due_date FROM meetings_issues_risks WHERE meeting_id = '" & intMtgID & "' AND exported_flg = '0' AND ir_type = '1'"
                                                'Response.Write(sqlA(i)) & "<br />"
      Set      objRS = objConn.Execute(sqlA(i))

      iNm(i) = objRS.Fields.Item("ir_name").Value
      iDs(i) = objRS.Fields.Item("ir_desc").Value
      iDd(i) = objRS.Fields.Item("ir_due_date").Value
            
      sqlXfer(i) = "INSERT INTO issues (issue_id,pid,issue_name,issue_description,date_due,date_assigned) " & _
      "VALUES ('" & intMaxVal + i & "','" & Session("SV_PID") & "','" & iNm(i) & "','" & iDs(i) & "','" & iDd(i) & "','" & Date & "')"
            
      'Response.Write(sqlXfer(i)) & "<br />"
      objConn.Execute sqlXfer(i)
                  
      'set the exported date and flag to 1
      sqlRS(i) = "UPDATE meetings_issues_risks SET date_exported = '" & Date & "', exported_flg = '1' WHERE meeting_id = '" & intMtgID & "' AND ir_type = '1' and exported_flg = '0'"
            
      'Response.Write(sqlRS(i)) & "<br />"
      objConn.Execute sqlRS(i)
                                          
next

Thanks, Peter
ASKER CERTIFIED SOLUTION
Adam Menkes
C# ASP.NET Developer
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros