binding to text box
I have the following codes. I can't figure out how to bind the right column to the right text box. PLease help me, what I have missed in the following codes.
Thanks a lot!!!
Private Sub btnCust_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSPFirst.Click
Dim nwindConn As SqlConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind")
Dim selectCMD As SqlCommand = New SqlCommand("SELECT CustomerID, CompanyName FROM Customers", nwindConn)
selectCMD.CommandTimeout = 30
Dim custDA As SqlDataAdapter = New SqlDataAdapter()
custDA.SelectCommand = selectCMD
nwindConn.Open()
Dim custDS As DataSet = New DataSet()
Me.txtID.Text = custDA.Fill(custDS, "Customers")
Me.txtName.Text = custDA.Fill(custDS, "Customers")
nwindConn.Close()
End Sub
|