manipulating SQL data using VB code but without binding to a datag

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to VB .NET: I can configure a SQL adapter and access data via the
datagrid. But how do you access and manipulate data if you do not require the
data to show up on a form. I simply want to audit a SQL table's data using
code to cycle through all records. The user doesn' t need to see the table
data.
Any help appreciated.
 
use can use a dataset to do updates.. or
you can use a regular update statement
 
I didn't explain myself well enough... sorry~ I guess what I am missing is
how to access the data without using a datagrid. Is a data reader the answer?
(I have only just started reading about those) or is there a dataset command
that allows me to access each field in a row from SQL?
 
Hi,

You can use code like this (where I open and loop through a dataset's
datatable):

Dim oconn As New SqlConnection("data source=d5z0071;initial
catalog=tennis;integrated security=sspi;")

Dim oda As New SqlDataAdapter("select * from league_t order by league",
oconn)

Dim ods As New DataSet()

oconn.Open()

oda.Fill(ods, "leagues")

Dim irow As DataRow

For Each irow In ods.Tables(0).Rows

messagebox.show(irow("league"))

Next

oconn.Close()

HTH,

Bernie Yaeger
 

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

Back
Top