Thanks for your followup Salam,
Yes, you can use two different DataAdapters to fill two different DataTable
(from different database....) in to the same DataSet instances... DataSet
is not bound to a certain connection... And when calling the
DataAdapter.Fil l method, just specify the datatable's name you want to fill.
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.)
--------------------
| Date: Mon, 05 Dec 2005 10:35:14 -0500
| From: cj <cj@nospam.nosp am>
| User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: Re: issuing sql command that references 2 database servers
| References: <ei************ **@TK2MSFTNGP14 .phx.gbl>
<$L************ **@TK2MSFTNGXA0 2.phx.gbl>
<#6************ **@TK2MSFTNGP12 .phx.gbl>
<7o************ *@TK2MSFTNGXA02 .phx.gbl>
| In-Reply-To: <7o************ *@TK2MSFTNGXA02 .phx.gbl>
| Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <ee************ **@TK2MSFTNGP10 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.vb
| NNTP-Posting-Host: 208.254.170.98
| Lines: 1
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl microsoft.publi c.dotnet.langua ges.vb:307248
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
|
| Can I do this?
|
| MyOdbcAdapter.F ill(MyDs, "recent_cal ls")
| SqlDataAdapter1 .Update(MyDs, "recent_cal ls")
| MyDs.Tables("re cent_calls").Cl ear()
| SqlDataAdapter1 .Fill(MyDs, "recent_cal ls")
| DataGrid1.DataS ource = MyDs.Tables("re cent_calls")
|
|
| Steven Cheng[MSFT] wrote:
| > Thanks for your followup CJ,
| >
| > Yes, so far to have to use the mutiple connection/commands approach is
| > there're tables in different database/server which will be processed at
the
| > same time...
| >
| > 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.)
| >
| >
| > --------------------
| > | Date: Fri, 02 Dec 2005 08:39:18 -0500
| > | From: cj <cj@nospam.nosp am>
| > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: issuing sql command that references 2 database servers
| > | References: <ei************ **@TK2MSFTNGP14 .phx.gbl>
| > <$L************ **@TK2MSFTNGXA0 2.phx.gbl>
| > | In-Reply-To: <$L************ **@TK2MSFTNGXA0 2.phx.gbl>
| > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <#6************ **@TK2MSFTNGP12 .phx.gbl>
| > | Newsgroups: microsoft.publi c.dotnet.langua ges.vb
| > | NNTP-Posting-Host: 208.254.170.98
| > | Lines: 1
| > | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP12.phx. gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.langua ges.vb:306951
| > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
| > |
| > | Thank you for your reply. I believe you are correct. I'd hoped
there
| > | was a way but didn't really expect to find on. If it was two tables
in
| > | two different databases on the SAME SERVER I think it would work but
| > | like you said since a sqlcommand is associated with one particular
| > | sqlconnection it can't see more than one server at a time.
| > |
| > | I expect I'll have to load them from one server into a dataset then
out
| > | to the new server. Unless anyone has any better ideas.
| > |
| > |
| > | Steven Cheng[MSFT] wrote:
| > | > Hi Cj,
| > | >
| > | > Welcome to MSDN newsgroup.
| > | > Regarding on the Sql command question ou mentioned, based on my
| > experience,
| > | > for executing two sql statement which refernece to table in
different
| > | > databases, we have to separate them into two SqlCommand objects and
| > | > executing them separately... The ADO.NET's SqlCommand is
associated
| > with
| > | > a certain SqlConnection(a certain database..), so for the two
| > sqlcommand ,
| > | > we have to create two sqlconnection instances for them....
| > | >
| > | > 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.)
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | Date: Thu, 01 Dec 2005 16:07:31 -0500
| > | > | From: cj <cj@nospam.nosp am>
| > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | > | X-Accept-Language: en-us, en
| > | > | MIME-Version: 1.0
| > | > | Subject: issuing sql command that references 2 database servers
| > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Message-ID: <ei************ **@TK2MSFTNGP14 .phx.gbl>
| > | > | Newsgroups: microsoft.publi c.dotnet.langua ges.vb
| > | > | NNTP-Posting-Host: 208.254.170.98
| > | > | Lines: 1
| > | > | Path:
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| > | > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.langua ges.vb:306864
| > | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vb
| > | > |
| > | > | I'm tryin to set up a sqlcommand in VB.NET that would issue the
| > command:
| > | > | insert into server1.databas e.owner.table select * from
| > | > | server2.databas e.owner.table
| > | > | Since this sqlcommand has it's connection property set to a
| > connection
| > | > | string for server1 I'm assuming it isn't seeing server2 -- I get
| > invalid
| > | > | object name server2.
| > | > |
| > | > | How can I get one sql statement to reference multiple servers?
| > | > |
| > | >
| > |
| >
|