Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 :

VB
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;"


VB
con.ConnectionString = con_str
       con.Open()


Now i Have a DataGridView , i want Fill Dataset(DS) by (CON) Connection And Table (Table1) , Then Fill Datagrid by (DS)

NOTE : Dont Use Wizard , Just Writing Code
Posted
Comments
thatraja 14-Nov-11 2:48am    
NOTE : Dont Use Wizard , Just Writing Code
:Confused:, Whose command this?

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.
 
Share this answer
 
HI HOW DID CREATE DATASET IN VB.NET CODEING & FORMS
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900