Results 1 to 2 of 2

Thread: Write loop results to database

  1. #1
    Geek_Guest
    Guest

    Write loop results to database

    Hi,

    I have two FOR loops in my script, with i and j variables. The sample script is like this,

    For i=1 to 10
    ---
    ---
    For j=i to 5
    --
    --
    Next
    ---
    ---
    Next

    Now my problem is, it should write all the results of j and i to the "Datatable". How ever it is writing the results of "j" for i=1 but over writing the table when i=2.

    Tried all the possiblities, like setting up to the Run Options, DataTable.SetCurrentRow(i) and DataTable.SetCurrentRow(j)...but unable to solve the problem.

    can anyone help me in this?

    Thank you

    Question asked by visitor Kavya


  2. #2
    Expert Member
    Join Date
    Sep 2007
    Answers
    110

    Re: Write loop results to database

    Hi,

    Try this code. Before run this code you have to change the parameter names of A and B as i ,j respectively.Then you will get all the values of i in the first column and values of j in the second column. Reply me if u have any doubts.


    For i=1 to 10
    datatable.SetCurrentRow(i)
    datatable(1,1)=i
    For j=i to 5
    datatable.SetCurrentRow(j)
    datatable(2,1)=j
    Next
    Next


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact