Fill Data Gridview Using Dataset
Fill Data Gridview Using Dataset
API Declarations
Imports System.Data.OleDb
Rate Fill Data Gridview Using Dataset
(1(1 Vote))
Try
DGrid.DataSource = ReturnData().Tables(0)
Catch ex As OleDbException
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Function ReturnData() As DataSet
Try
Dim OleCon As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB")
OleCon.Open()
Dim OleCom As New System.Data.OleDb.OleDbCommand("SELECT * FROM Products", OleCon)
OleCom.CommandType = CommandType.Text
Dim OleAdap As New System.Data.OleDb.OleDbDataAdapter(OleCom)
Dim OleDSet As New DataSet()
OleAdap.Fill(OleDSet)
Return OleDSet
Catch ex As Exception
Throw ex
End Try
End Function
Fill Data Gridview Using Dataset Comments
No comments yet — be the first to post one!
Post a Comment