Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Access VB.NET
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 at 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 2

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

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

  Print Answers RSS
0 OriginalGriff 310
1 Sergey Alexandrovich Kryukov 166
2 PhilLenoir 164
3 Richard MacCutchan 160
4 Sharmanuj 146
0 Sergey Alexandrovich Kryukov 6,081
1 OriginalGriff 5,115
2 CPallini 2,473
3 Richard MacCutchan 1,597
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2014
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