asp.net - For each statement not being executed in a While statement? -


i trying each statement inside while statement , not executing code within each statment. assuming "value" not being assigned somehow?

cmd = new sqlcommand cmd.connection = con cmd.commandtext = "select [physician first name], [physician last name], [recipient primary business street address line 1], [recipient city], [recipient state], [recipient zip code], notes_consultingfee, [total amount of payment]  tbldata referencenumber = @referencenumber" cmd.parameters.add(new sqlparameter("@referencenumber", (referencetextbox.text))) dim reader sqldatareader = cmd.executereader()  while reader.read()     each value object in reader          dim firstname = reader.getstring(0)         dim lastname = reader.getstring(1)         dim address = reader.getstring(2)         dim city = reader.getstring(3)         dim state = reader.getstring(4)         dim zip = reader.getstring(5)         dim notes = reader.getstring(6)         dim amount decimal = reader(7)         session("pdf") &= firstname & " " & lastname & environment.newline & address & environment.newline & city & "," & state & " " & zip & environment.newline & "consulting fee amount: " & amount & environment.newline & "notes: " & notes     next end while 

you not need for each loop @ all, while loop iterate through reader you, this:

while reader.read()     dim firstname = reader.getstring(0)     dim lastname = reader.getstring(1)     dim address = reader.getstring(2)     dim city = reader.getstring(3)     dim state = reader.getstring(4)     dim zip = reader.getstring(5)     dim notes = reader.getstring(6)     dim amount decimal = reader(7)     session("pdf") &= firstname & " " & lastname & environment.newline & address & environment.newline & city & "," & state & " " & zip & environment.newline & "consulting fee amount: " & amount & environment.newline & "notes: " & notes end while 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -