1.

What Are The Steps Involved To Fill A Dataset?

Answer»

a. Create a connection object.
b. Create an adapter by PASSING the string query and the connection object as PARAMETERS.
c. Create a new object of dataset.
d. Call the Fill method of the adapter and pass the dataset object.

Example:
VB.NET Code:-
DIM strSQL as String
strSQL = "SELECT * from tbl"
Dim SQLCMD As New SqlCommand(strSQL, sqlConn)
Dim SDA As New SqlDataAdapter(sqlCmd)
Dim ds As New DataSet
sda.Fill(ds)

a. Create a connection object.
b. Create an adapter by passing the string query and the connection object as parameters.
c. Create a new object of dataset.
d. Call the Fill method of the adapter and pass the dataset object.

Example:
VB.NET Code:-
Dim strSQL as String
strSQL = "SELECT * from tbl"
Dim sqlCmd As New SqlCommand(strSQL, sqlConn)
Dim sda As New SqlDataAdapter(sqlCmd)
Dim ds As New DataSet
sda.Fill(ds)



Discussion

No Comment Found