how can i Connect to data base Access And Set DataSet (Without Wizard
) By Writing Code ?
Example: I can connect Data base By This Code :
Dim da As New OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim con As OleDb.OleDbConnection
Dim con_str As String = "provider=microsoft.jet.oledb.4.0;data source=e:\damyar.mdb;"
con.ConnectionString = con_str
Now i Have a DataGridView , i want Fill Dataset(DS) by (CON) Connection And Table (Table1) , Then Fill Datagrid by (DS)
: Dont Use Wizard , Just Writing Code
This looks suspiciously like homework, so no code!
1) Create an SQL SELECT statement: "SELECT * FROM MyTable" will do, where MyTable is the name of the table to want to access.
2) Create an OleDbDataAdapter, and use the select statement and your connection to create a new instance.
3) Create a DataSet object, and assign a new instance to it.
4) Fill the DataSet from the OleDbDataAdapter (HINT: use the Fill method)
5) Set the DataGridView DataSource property to the first table in the DataSet.
HI HOW DID CREATE DATASET IN VB.NET CODEING & FORMS
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)