Re: fill dataset/grid with multiple queries from multiple servers

From: Mike Smith (test_at_test.com)
Date: 07/20/04


Date: Tue, 20 Jul 2004 16:15:31 +0800

yup the + comes on when u dont specify the table.. its sorta like a cool
featue i guess.. hahaha.. for asp.net u get the first table immediately
cause they cant render those fancy stuff.. anyway.......

u got 2 ways..

datagrid1.datasource=ds.tables(0)
or
datagrid1.datasource=ds
datagrid1.datamember="TableName"

-- 
Regards,
Mike
http://bikesh.europe.webmatrixhosting.net
http://www.planetsourcecode.com (search keyword: phoetus)
"Dave Edwards" <none@none.com> wrote in message
news:hU4Lc.43$2i.22@newsfe2-gui.ntli.net...
> Well I managed to pul something together myself in the end that works
quite
> well
>
> Dim I As Integer
> Dim dsXMLData As New DataSet
> Dim DS As New DataSet
>
> dsXMLData.ReadXml("serverlist.xml")
>
> For I = 0 To dsXMLData.Tables(0).Rows.Count - 1
>     Dim connect As New SqlConnection("Integrated
> Security=SSPI;database=database;server=" &
> dsXMLData.Tables(0).Rows(I).Item(0))
>     connect.Open()
>     Dim command As String = "SELECT * form table"
>     Dim adaptor As SqlDataAdapter = New SqlDataAdapter(command, connect)
>     adaptor.Fill(DS)
>     DataGrid1.DataSource = DS
> Next I
>
> The onlt problem I have is that I now need to navigate through the
datagrid
> to get to the data. When the app first opens I get a + sign on the
datagrid,
> clicking that I get the word table and clicking that I get to the data,
any
> ideas how to get straight to the data?
>
> Cheers
> Charlie.
>
> "Mike Smith" <test@test.com> wrote in message
> news:%23BiXejbbEHA.2352@TK2MSFTNGP09.phx.gbl...
> > wouldnt u just have to pass it to a different connection then before u
> > execute the dataadapter ?
> > or just use the same connection itself but the data source portion of
the
> > connection string would be referencing the server name as a variable
that
> is
> > passed as a parameter ..
> >
> > "Dave Edwards" <none@none.com> wrote in message
> > news:7pQKc.178$P21.79@newsfe2-gui.ntli.net...
> > > I understand that I can fill a datagrid with multiple queries, but I
> > cannot
> > > figure out how to fill a dataset with the same query but run against
> > > multiple SQL servers, the query , table structure and username,
password
> > etc
> > > will be exactly the same for each server, the only thing that will
> change
> > is
> > > the server name. Idealy I would like to get the server names from a
> > seperate
> > > dataset so there could be any number of servers, allthough in practice
> it
> > > would be unlikely that there would be more than 3 servers.
> > >
> > > Any Ideas, I'm a bit lost.
> > > Cheers
> > > Dave.
> > >
> > >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free. (well i'd like to think it is.. )
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.723 / Virus Database: 479 - Release Date: 19/07/2004
> >
> >
>
>
yup the + comes on when u dont specify the table.. its sorta like a cool
featue i guess.. hahaha.. for asp.net u get the first table immediately
cause they cant render those fancy stuff.. anyway.......
u got 2 ways..
datagrid1.datasource=ds.tables(0)
or
datagrid1.datasource=ds
datagrid1.datamember="TableName"
-- 
Regards,
Mike
http://bikesh.europe.webmatrixhosting.net
http://www.planetsourcecode.com (search keyword: phoetus)
"Dave Edwards" <none@none.com> wrote in message
news:hU4Lc.43$2i.22@newsfe2-gui.ntli.net...
> Well I managed to pul something together myself in the end that works
quite
> well
>
> Dim I As Integer
> Dim dsXMLData As New DataSet
> Dim DS As New DataSet
>
> dsXMLData.ReadXml("serverlist.xml")
>
> For I = 0 To dsXMLData.Tables(0).Rows.Count - 1
>     Dim connect As New SqlConnection("Integrated
> Security=SSPI;database=database;server=" &
> dsXMLData.Tables(0).Rows(I).Item(0))
>     connect.Open()
>     Dim command As String = "SELECT * form table"
>     Dim adaptor As SqlDataAdapter = New SqlDataAdapter(command, connect)
>     adaptor.Fill(DS)
>     DataGrid1.DataSource = DS
> Next I
>
> The onlt problem I have is that I now need to navigate through the
datagrid
> to get to the data. When the app first opens I get a + sign on the
datagrid,
> clicking that I get the word table and clicking that I get to the data,
any
> ideas how to get straight to the data?
>
> Cheers
> Charlie.
>
> "Mike Smith" <test@test.com> wrote in message
> news:%23BiXejbbEHA.2352@TK2MSFTNGP09.phx.gbl...
> > wouldnt u just have to pass it to a different connection then before u
> > execute the dataadapter ?
> > or just use the same connection itself but the data source portion of
the
> > connection string would be referencing the server name as a variable
that
> is
> > passed as a parameter ..
> >
> > "Dave Edwards" <none@none.com> wrote in message
> > news:7pQKc.178$P21.79@newsfe2-gui.ntli.net...
> > > I understand that I can fill a datagrid with multiple queries, but I
> > cannot
> > > figure out how to fill a dataset with the same query but run against
> > > multiple SQL servers, the query , table structure and username,
password
> > etc
> > > will be exactly the same for each server, the only thing that will
> change
> > is
> > > the server name. Idealy I would like to get the server names from a
> > seperate
> > > dataset so there could be any number of servers, allthough in practice
> it
> > > would be unlikely that there would be more than 3 servers.
> > >
> > > Any Ideas, I'm a bit lost.
> > > Cheers
> > > Dave.
> > >
> > >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free. (well i'd like to think it is.. )
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.723 / Virus Database: 479 - Release Date: 19/07/2004
> >
> >
>
>

Quantcast