how to insert multiple records in the code below using "for" loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • uma9
    New Member
    • Feb 2009
    • 2

    how to insert multiple records in the code below using "for" loop

    hi,
    the code below is used to insert a single record....i want to know how to insert multiple records using a "for" loop...please help

    Set connect = CreateObject ("ADODB.Connect ion")
    connect.open "DSN=OPTUMETL;D river= Oracle in OraHome92;Serve r=urnts1.uhc.co m;UID=OPTUMETL; PWD=OPTUMETL"
    Reporter.Report Event 0, "Database connection", "Successful ly connected to URNTS1"
    Set objRecordset = CreateObject("A DODB.Recordset" )
    ' Stmt to execute the code
    query="INSERT INTO STG_CARE.ASSESS MENTANSWER(ANSW ERID, ANSWERGROUPID, ANSWERTEXT, DISPLAYSEQUENCE , ISEXCLUSIVENO, ISEXCLUSIVEYES,
    CREATEBY, CREATEDATE, UPDATEBY, UPDATEDATE, RECORDSTATUS, RECORDVERSION, RECORDSOURCE, SYNCDATE, RECORDUNIQUEID,
    PARENTRECORDUNI QUEID, AUDIT_CREAT_DT, AUDIT_UPDATE_DT , SRC_SYSTEM_ID)V ALUES(95149, 95052, 'Yes (Red Flag)', 10, 0, 0, 1, TO_DATE('11/10/2005
    01:05:29 PM','DD/MM/YYYY HH12:MI:SS PM'), 1, TO_DATE('11/10/2005 01:05:29 PM','DD/MM/YYYY HH12:MI:SS PM'), 0, 1, 0, TO_DATE('01/01/1900 12:00:00
    AM','DD/MM/YYYY HH12:MI:SS PM'), 0, NULL, TO_DATE('18/08/2008 06:06:16 AM','DD/MM/YYYY HH12:MI:SS PM'), TO_DATE('18/08/2008 06:09:13 AM','DD/MM/YYYY
    HH12:MI:SS PM'), 'CARE')"
    msgbox query
    Set objResults = connect.Execute (query) ' Cmd used to execute the sql
    '
    Reporter.Report Event 0, "Query execution", "Executed query successfully"
    '
    'objResults.Clo se
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    what is the problem, just run the query in a loop.

    Comment

    • uma9
      New Member
      • Feb 2009
      • 2

      #3
      thanks debasisdas.....
      i have not worked in VB before.....so can u please give me the query in the loop....

      Comment

      • Nulli cedo
        New Member
        • Jun 2009
        • 9

        #4
        Hi, did you fix this yet?

        Comment

        Working...