Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding value from database to datatable
#2
Solved: 10 Years, 9 Months, 3 Weeks ago
You are adding a new datatable column each time, move this line outside the loop and remove strUserid so you just create a single new datatable column:

Datatable.GlobalSheet.AddParameter "UserId" , ""


Then in place of that line in the loop just assign the value strUserid to the datatable so:

Datatable("UserId", dtGlobalSheet) = strUserid


Code:
strSQL = " Select * from UserId"
Set objResults = objDB.Execute(strSQL)
nrow=1
Datatable.GlobalSheet.AddParameter "UserId" , ""
Do Until objResults.EOF
     strUserid = objResults.Fields("UserId")
     Datatable.SetCurrentRow(nrow)
     Datatable("UserId", dtGlobalSheet) = strUserid
     msgbox Datatable("UserId",dtGlobalSheet)
     Reporter.ReportEvent micDone, strUserid , " "
     objResults.MoveNext
     nrow=nrow+1
Loop
Reply


Messages In This Thread
RE: Adding value from database to datatable - by SteveS - 07-04-2013, 01:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pages and Frames adding _1, _2, _3... zunebuggy 1 1,515 05-30-2017, 12:17 AM
Last Post: Vichu M J
  Adding negative amount in webedit Rose 1 2,013 06-30-2016, 09:34 PM
Last Post: babu123
  Adding data into rows that add dynamically with setcelldata azar81 4 5,677 04-13-2015, 05:24 PM
Last Post: vidya2k2
  Function writes data from datatable to database Fairbanks 0 2,406 06-27-2014, 07:51 PM
Last Post: Fairbanks
  adding webtable to dictonaryobject prabu211989 2 2,460 01-06-2014, 07:56 PM
Last Post: Parke

Forum Jump:


Users browsing this thread: 1 Guest(s)