display data in a text box using the click of a Button in .aspx p

G

Guest

hello,
how can I display data from a Data source such as SQL Server in a
textbox by using the click of a Button on an .aspx page in a Visual Basic
..Net Project . If I have to use a DataSet, then how, please explain step by
step, I am new to .Net. I am using my own database in SQL Server, with all
the tables created.

Thank You
 
K

Ken Tucker [MVP]

Hi,

Try something like this.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim cn As New SqlConnection("server=localhost;" & _

"Integrated Security=SSPI;Initial Catalog=NorthWind")

Dim da As SqlDataAdapter

Dim ds As New DataSet

da = New SqlDataAdapter("Select * from Customers", cn)

ds = New DataSet

da.Fill(ds)

TextBox1.Text = ds.Tables(0).Rows(1).Item("CustomerID").ToString

End Sub



Ken

----------------------

hello,
how can I display data from a Data source such as SQL Server in a
textbox by using the click of a Button on an .aspx page in a Visual Basic
..Net Project . If I have to use a DataSet, then how, please explain step by
step, I am new to .Net. I am using my own database in SQL Server, with all
the tables created.

Thank You
 

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

Top