Re: Batch commands & Ms-Access
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Wed, 14 Dec 2005 07:31:55 GMT
Hey Cor,
It is not only Access, you cannot use Batch SQL commands in ADONET.
====================
I don't quite think so, for SQLServer, we can execute two sql query through
single statement in a SqlCommand instance.... And we can let the DataReader
return two ResultSet or let the DataAdpater fill two DataTable into a
DataSet..... e.g:
SqlConnection conn = new
SqlConnection("server=(local);database=ncs;uid=ncs;pwd=ncs;");
SqlCommand cmd = new SqlCommand("select * from ncsuser;select * from
ncshistory", conn);
I've ever done this through both Sql managed provider or OleDbProvider.....
(And for Access ,we can not even execute such mutpile select query through
its query wizard....., so this is DataBase specific, nothing to do with
ADO.NET.....)
Hi Selva,
For your scenario, that you need to query two tables from Access Db and
store them into a single DataSet, we need to execute two select statements
separately and fill them into the same DataSet (specify the table name...),
then we can add the relation for the two DataTables in the DataSet...
e.g:
==============================
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLoad.Click
Try
Dim conn As OleDbConnection
Dim adapter As OleDbDataAdapter
Dim adapter1 As OleDbDataAdapter
conn = New OleDbConnection("Jet OLEDB:Database Locking
Mode=1;Data
Source=""F:\users\stcheng\workspace\dotnet\CS\winform\WindowsApplication2\bi
n\Debug\Northwind.mdb"";Mode=Share Deny None;Jet OLEDB:Engine
Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";")
adapter = New OleDbDataAdapter("select * from Orders", conn)
adapter.Fill(ds, "Orders")
Me.DataGrid1.DataSource = ds
Me.DataGrid1.DataMember = "Orders"
adapter.SelectCommand = New OleDbCommand("select * from [Order
Details]", conn)
adapter.Fill(ds, "Order Details")
Me.DataGrid2.DataSource = ds
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
==========================
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
| References: <u2CQaq0$FHA.3136@xxxxxxxxxxxxxxxxxxxx>
<VAgJbc7$FHA.3764@xxxxxxxxxxxxxxxxxxxxx>
<77E1B6D5-2922-47DE-8D4E-D4646F7A5A12@xxxxxxxxxxxxx>
<OeJdIa$$FHA.1256@xxxxxxxxxxxxxxxxxxxx>
<1774E3ED-A302-47E4-9311-B5ECA88C0849@xxxxxxxxxxxxx>
| Subject: Re: Batch commands & Ms-Access
| Date: Tue, 13 Dec 2005 16:33:07 +0100
| Lines: 19
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <uGpdyp$$FHA.3296@xxxxxxxxxxxxxxxxxxxx>
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: ip3e830773.speed.planet.nl 62.131.7.115
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.vb:308475
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Selva,
|
| If you use Net 1.x than you need two selects for it.
|
| Net 2.0 has a new feature however that I did not try yet. If you use that
| than, just use the create datasource in the Data tab from Visual Studio.
|
| In net 1.x you need just two seperate Fills and add the relation.
|
| See this page for how to create a relation (The tables are here build on
| the fly in the sample)
|
|
http://www.vb-tips.com/default.aspx?ID=d667d78f-4b08-42ef-ba3b-8b8620d93761
|
| I hope this helps,
|
| Cor
|
|
|
.
- Follow-Ups:
- Re: Batch commands & Ms-Access
- From: m.posseth
- Re: Batch commands & Ms-Access
- From: Cor Ligthert [MVP]
- Re: Batch commands & Ms-Access
- References:
- Batch commands & Ms-Access
- From: Selva Chinnasamy
- RE: Batch commands & Ms-Access
- From: Steven Cheng[MSFT]
- Re: Batch commands & Ms-Access
- From: Cor Ligthert [MVP]
- Re: Batch commands & Ms-Access
- From: Selva
- Re: Batch commands & Ms-Access
- From: Cor Ligthert [MVP]
- Batch commands & Ms-Access
- Prev by Date: Re: list in memory
- Next by Date: Re: extract text from html
- Previous by thread: Re: Batch commands & Ms-Access
- Next by thread: Re: Batch commands & Ms-Access
- Index(es):
Relevant Pages
|