HighTechTalks DotNet Forums  

access, vb.net

Dotnet Framework (ODBC.net) microsoft.public.dotnet.framework.odbcnet


Discuss access, vb.net in the Dotnet Framework (ODBC.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
joanne via .NET 247
 
Posts: n/a

Default access, vb.net - 03-15-2005 , 03:45 PM






What is the code in vb.net to run query stored in access (and display the result in a datagrid)?


--------------------------------
From: joanne

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>dcf6iYNPo0ubp9ePrld2Ag==</Id>

Reply With Quote
  #2  
Old   
Paul Clement
 
Posts: n/a

Default Re: access, vb.net - 03-16-2005 , 10:40 AM






On Tue, 15 Mar 2005 12:45:05 -0800, joanne via .NET 247 <anonymous (AT) dotnet247 (DOT) com> wrote:

¤ What is the code in vb.net to run query stored in access (and display the result in a datagrid)?
¤

Dim AccessConn As System.Data.OleDb.OleDbConnection

AccessConn = New System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

Dim AccessCommand As New System.Data.OleDb.OleDbCommand("qryTable1", AccessConn)
AccessCommand.CommandType = CommandType.StoredProcedure

Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter

With da
.SelectCommand = AccessCommand
End With

Dim ds As New DataSet("QueryTables")
da.Fill(ds, "Table1")

DataGrid1.SetDataBinding(ds, "Table1")

AccessConn.Close()


Paul
~~~~
Microsoft MVP (Visual Basic)

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.