Recent Posts

Monday, August 18, 2008

How to get data from the Database using dataset in .Net

First go to following link
Secure connection and easy transaction handling in .Net

to understand the logic for the connection
and to get the idea of what objDB.getDataSet means.

Then use the following function to get the values from the table named Books:

Private Function GetBooks() As Boolean
Dim strSql As String
Dim ds As DataSet

dim objBook as clsBook()

strSql = "SELECT * from Books"

ds = objDB.getDataset(strSql)
If ds.Tables(0).Rows.Count > 0 Then
For Each row As DataRow In ds.Tables(0).Rows
objBook = new clsBook()

objBook.BookID = row("BookingID")
ObjBook.BookName = row ("BookName")


GetBooks = False
End If
Catch ex As Exception

Throw ex
End Try
End Function

Related Posts by Categories

No comments:

Post a Comment