SELECT in the dataset

yaniv

Well-known member
Joined
Apr 15, 2002
Messages
162
Location
israel
Well, I just want to get the "lastname" column from dataset table, where id = 1, But i cant find the way to do it.

The dataset.select returns only datarows object which is too complicated for the simple task.

can it be done?
my dataset called "product" and the table is "product" too.
 
hello roby,

the sql is good to get thedata from the database, but i want to get from the dataset, where should i put the sql statment? you dont have "commandtext" in datasets.
 
Do some research on the following code. You will need to add your connection to the database oConn. When your connection is set you will need to change Oracle to OLEDB, sql, etc. on the first 3 lines and import the appropriate namespace.

Dim da As OracleDataAdapter
Dim ds As New DataSet
Dim cmd As New OracleCommand

cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT lasstname from Product _
WHERE ID = 1"
cmd.Connection = oConn

da = New OracleDataAdapter(cmd)
Try
da.Fill(ds)
Catch ex As Exception
MessageBox.Show(ex.Message.ToString)

End Try

oConn.Close()
 
I am looking to do the same thing. I would like to pull in my data into the dataset from an XML file. Then do a SELECT on the dataset.
This may not be the logic way to do this, but I am wondering if it is possible.
 
if you want to do the select on all table, and not just to get one field, use dataview.
type dataview in th serch and walk with the walkthrow
 
Back
Top