Monday, April 28, 2014

Retrieving information from database into text box.




Hi!



I am trying to retrive information data from Access database into textbox in vb.net. I am able to get the count but not able to display it in the database.



For example: total state in india is 29. so need to display all the names. I have textbox in the form as statename1.text, statename2.text, statename3.text till statename29.text. So I want to display in loop.





dim i, p as integer

command = New OleDbCommand("Select state from country where country="India""", connection)

dataReader = command.ExecuteReader

dataReader.Read()



i = 1

P = 0





Do While i <> 30

statename & i &.text = dataReader(P).ToString()







P = P + 1

i = i + 1

Loop



I am trying something like this but i know, its not right. Please advice. I am getting error on "statename & i &.text"



Regards,



Prabhu Venkatraman





No comments:

Post a Comment