Hey Selva,
Your ADO.NET code is correct and nothing wrong here. The limitation here is
due to the Access DataBase's query enging which doesn't support multiple
querystatements ......
Thanks & Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Batch commands & Ms-Access
| thread-index: AcYCStP5u936hkiDTxq9tTJbVoupYw==
| X-WBNR-Posting-Host: 199.231.49.128
| From: "=?Utf-8?B?U2VsdmE=?=" <Se***@discussions.microsoft.com>
| References: <u2**************@TK2MSFTNGP15.phx.gbl>
<VA**************@TK2MSFTNGXA02.phx.gbl>
<77**********************************@microsoft.co m>
<Oe**************@TK2MSFTNGP15.phx.gbl>
<17**********************************@microsoft.co m>
<uG**************@TK2MSFTNGP12.phx.gbl>
<0G**************@TK2MSFTNGXA02.phx.gbl>
<uK**************@TK2MSFTNGP12.phx.gbl>
| Subject: Re: Batch commands & Ms-Access
| Date: Fri, 16 Dec 2005 06:13:03 -0800
| Lines: 160
| Message-ID: <0D**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.languages.vb
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSF TNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.languages.vb:308928
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Michel- When I had couple Select statements seperated with ; I am getting
an
| error.
| I am using OleDb Adapter against Ms-Access.
|
| Is there any Connection setting that I need to aware of.
|
| Thanks
| Selva
|
| "m.posseth" wrote:
|
| > even better
| > i combine hundred inserts at once in my sql import application
| >
| > i also performed multiple DDL statements at once just seprate them
with a
| > ; and there you go
| >
| >
| > :-)
| >
| > regards
| >
| > Michel Posseth [MCP]
| >
| >
| >
| > "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| > news:0G**************@TK2MSFTNGXA02.phx.gbl...
| > > 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\winf orm\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]" <no************@planet.nl>
| > > | References: <u2**************@TK2MSFTNGP15.phx.gbl>
| > > <VA**************@TK2MSFTNGXA02.phx.gbl>
| > > <77**********************************@microsoft.co m>
| > > <Oe**************@TK2MSFTNGP15.phx.gbl>
| > > <17**********************************@microsoft.co m>
| > > | 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: <uG**************@TK2MSFTNGP12.phx.gbl>
| > > | Newsgroups: microsoft.public.dotnet.languages.vb
| > > | NNTP-Posting-Host: ip3e830773.speed.planet.nl 62.131.7.115
| > > | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.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?...b-8b8620d93761
| > > |
| > > | I hope this helps,
| > > |
| > > | Cor
| > > |
| > > |
| > > |
| > >
| >
| >
| >
|