Click here to Skip to main content
13,089,610 members (48,195 online)
Rate this:
 
Please Sign up or sign in to vote.
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 :

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
       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 13-Nov-11 20:19pm
synctor394
Comments
thatraja 14-Nov-11 2:48am
   
NOTE : Dont Use Wizard , Just Writing Code
:Confused:, Whose command this?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

HI HOW DID CREATE DATASET IN VB.NET CODEING & FORMS
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100