Binding textboxes

B

Big E

I create a Connection, SQL DataAdapter, DataTable, DataSet and Fill the
Table. Now I want to bind the data in the Table to textboxes on the ASP.Net
page. I thought I could do something as simple as Textbox1.Text =
dtReg.Columns.Row(dataintable). I would rather do it in the .vb file than in
the aspx page.

I can't figure out how to do it.

Thanks.



Dim Portal As String

Dim dsReg As DataSet

Dim cnPortal As SqlConnection

Dim daReg As SqlDataAdapter

Dim dtReg As DataTable = New DataTable

Portal = ConfigurationSettings.AppSettings("Portal.ConnectionString")

dsReg = New DataSet

cnPortal = New SqlConnection(Portal)

daReg = New SqlDataAdapter("SELECT * FROM tblProspect WHERE Fname= '" &
varFirstName & "' and Lname ='" & varLastName & "'and HomePhone ='" &
varPhone & "'", cnPortal)

daReg.Fill(dsReg, "tblProspect")

dtReg = dsReg.Tables("tblProspect")
 
J

John Saunders

Big E said:
I create a Connection, SQL DataAdapter, DataTable, DataSet and Fill the
Table. Now I want to bind the data in the Table to textboxes on the ASP.Net
page. I thought I could do something as simple as Textbox1.Text =
dtReg.Columns.Row(dataintable). I would rather do it in the .vb file than in
the aspx page.

Did that even compile?

Try dtReg.Rows(intRowNum)("columnName") instead.
 
B

Big E

No it didn't compile. I just made that up as a example of the various things
I've tried.

What is the part after Rows..... --> (intRowNum).?
I've used that when I have a combobox and add contents through looping. How
would I use it if there will only be one record with a textbox.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top