VB.Net GridView DataBinding in ASP.Net

In this sample we have used the VB.Net code for binding the data to the ASP.Net GridView control. The Northwind SQL database has been used to display the categoryId, categoryName and description retrieved from the categories table. In the VB.Net code for Gridview databinding we have used the following class objects to specify the data source using connectionstring, sql command to fetch the required data and a dataset to store the retrieved records.

DataBinding Elements Used

1. SqlConnection

2. SqlCommand

3. SqlAdapter

4. DataSet

 

See the sample below to understand the output of the VB.Net GridView Databinding code:

 

CategoryIDCategoryNameDescription
1BeveragesSoft drinks, coffees, teas, beers, and ales
2CondimentsSweet and savory sauces, relishes, spreads, and seasonings
3ConfectionsDesserts, candies, and sweet breads
4Dairy ProductsCheeses
5Grains/CerealsBreads, crackers, pasta, and cereal
6Meat/PoultryPrepared meats
7ProduceDried fruit and bean curd
8SeafoodSeaweed and fish
  • HIRE EzineASP.Net Developers