Assign the command object to the SqlDataAdapterĭim SelectQry = “SELECT * FROM Products ”ĭim SampleDataAdapter = New SqlDataAdapter() Connect the command object with the opened active connectionĤ. Initialize the SqlDataAdapter and DataSetĭim SampleDataAdapter As New SqlDataAdapterģ. But in this example I am going to use SqlDataAdapter and DataSet.ġ. We have several options to fetch the data. Next step is to use the opened connection to fetch data. Note: Northwind database can be obtained from MSDN Since we have already decided to use the SqlClient, we have to use SqlConnection to open a connection as follows.ĭim ConnectionToFetch As New SqlConnectionĬonnectionToFetch.ConnectionString = “Server= localhost\SQLEXPRESS Database=Northwind Trusted_Connection=true” Next step is to get the connection to the database. We are going to use the following namespaces for using the database related objects in ADO.Net, Since the coming articles in this website will refer back this article for DataBinding samples While data reader also can be used for light weight read only purposes, I am explaining here with dataset. Provided the knowledge of connecting to database, executing the SQL Select Queries and filling the dataset with the data fetched is necessary.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |