|
|
|
start date: Tue, 31 Jul 2007 15:37:34 -0000,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
unknown
|
|
2
Morten Wennevik [C# MVP]
|
|
3
Ralf Ehlert
|
|
4
Morten Wennevik [C# MVP]
|
|
5
unknown
|
How to contruct a ConnectionString to connect to dataset?
Hi,
We have bunch of DataObejcts/BusinessObjects those used against
database. Now we fetch some data from database into a dataset. How can
we contruct a ConnectionString to connect to this dataset so we can
use those DataObejcts/BusinessObjects?
Thanks
Date:Tue, 31 Jul 2007 15:37:34 -0000
Author:
|
Re: How to contruct a ConnectionString to connect to dataset?
On Tue, 31 Jul 2007 17:37:34 +0200, wrote:
> Hi,
>
> We have bunch of DataObejcts/BusinessObjects those used against
> database. Now we fetch some data from database into a dataset. How can
> we contruct a ConnectionString to connect to this dataset so we can
> use those DataObejcts/BusinessObjects?
>
> Thanks
>
>
Eh? You use a connection string to connect to a database, but you say you already fetched the data and stored it in a DataSet? If so, the DataSet will contain one or more DataTable objects depending on how and what you fetched from the database. The DataTable object may have DataRow objects in its Rows property. The data will be inside these row objects.
However, I suspect this is not what you mean. If you want to know how to retrieve data from a database and store it in a DataSet you typically use an SqlDataAdapter (or OleDBDataAdapter) and its Fill method. Or use SqlCommand.ExecuteReader (or OleDBCommand.ExecuteReader) and create a list of objects manually.
--
Happy coding!
Morten Wennevik [C# MVP]
Date:Tue, 31 Jul 2007 18:40:35 +0200
Author:
|
Re: How to contruct a ConnectionString to connect to dataset?
On Jul 31, 12:40 pm, "Morten Wennevik [C# MVP]"
wrote:
> On Tue, 31 Jul 2007 17:37:34 +0200, wrote:
> > Hi,
>
> > We have bunch of DataObejcts/BusinessObjects those used against
> > database. Now we fetch some data from database into a dataset. How can
> > we contruct a ConnectionString to connect to this dataset so we can
> > use those DataObejcts/BusinessObjects?
>
> > Thanks
>
> Eh? You use a connection string to connect to a database, but you say you already fetched the data and stored it in a DataSet? If so, the DataSet will contain one or more DataTable objects depending on how and what you fetched from the database. The DataTable object may have DataRow objects in its Rows property. The data will be inside these row objects.
>
> However, I suspect this is not what you mean. If you want to know how to retrieve data from a database and store it in a DataSet you typically use an SqlDataAdapter (or OleDBDataAdapter) and its Fill method. Or use SqlCommand.ExecuteReader (or OleDBCommand.ExecuteReader) and create a list of objects manually.
>
> --
> Happy coding!
> Morten Wennevik [C# MVP]
Thanks, Morten
We have some business logic in our DataObejcts/BusinessObjects (such
as getting data by runing stored procedure, doing some checking
up ...). Now we load a few tables data into dataset (we don't want to
lock database for a long time), we want to use our DataObejcts/
BusinessObjects against it as it against the orignal database. I think
one way is contruct a connection string to connect to this dataset
instead of the original database.
Do you have any idea about this?
Thanks very much.
Date:Tue, 31 Jul 2007 17:11:18 -0000
Author:
|
Re: How to contruct a ConnectionString to connect to dataset?
If you have buisness objects then you work with these objects like any other
objects/classes. Since .NET 2.0 you use objects as data sources too (or it is
more easier as in the previos versions) but you have to store these objects
back into your database.
Maybe you should look on Visual Studio 2008 and LINQ to SQL- Every edition
of VS2008 (incl. the express editions) contains the ORM designer which mapps
your database tables to objects and back to persistent the state of your
objects.
Or i haven't understand what your problem is.
"jzdeng@gmail.com" wrote:
> On Jul 31, 12:40 pm, "Morten Wennevik [C# MVP]"
> wrote:
> > On Tue, 31 Jul 2007 17:37:34 +0200, wrote:
> > > Hi,
> >
> > > We have bunch of DataObejcts/BusinessObjects those used against
> > > database. Now we fetch some data from database into a dataset. How can
> > > we contruct a ConnectionString to connect to this dataset so we can
> > > use those DataObejcts/BusinessObjects?
> >
> > > Thanks
> >
> > Eh? You use a connection string to connect to a database, but you say you already fetched the data and stored it in a DataSet? If so, the DataSet will contain one or more DataTable objects depending on how and what you fetched from the database. The DataTable object may have DataRow objects in its Rows property. The data will be inside these row objects.
> >
> > However, I suspect this is not what you mean. If you want to know how to retrieve data from a database and store it in a DataSet you typically use an SqlDataAdapter (or OleDBDataAdapter) and its Fill method. Or use SqlCommand.ExecuteReader (or OleDBCommand.ExecuteReader) and create a list of objects manually.
> >
> > --
> > Happy coding!
> > Morten Wennevik [C# MVP]
>
> Thanks, Morten
>
> We have some business logic in our DataObejcts/BusinessObjects (such
> as getting data by runing stored procedure, doing some checking
> up ...). Now we load a few tables data into dataset (we don't want to
> lock database for a long time), we want to use our DataObejcts/
> BusinessObjects against it as it against the orignal database. I think
> one way is contruct a connection string to connect to this dataset
> instead of the original database.
>
> Do you have any idea about this?
>
> Thanks very much.
>
>
>
>
>
Date:Tue, 31 Jul 2007 12:06:14 -0700
Author:
|
Re: How to contruct a ConnectionString to connect to dataset?
On Tue, 31 Jul 2007 19:11:18 +0200, wrote:
> On Jul 31, 12:40 pm, "Morten Wennevik [C# MVP]"
> wrote:
>> On Tue, 31 Jul 2007 17:37:34 +0200, wrote:
>> > Hi,
>>
>> > We have bunch of DataObejcts/BusinessObjects those used against
>> > database. Now we fetch some data from database into a dataset. How can
>> > we contruct a ConnectionString to connect to this dataset so we can
>> > use those DataObejcts/BusinessObjects?
>>
>> > Thanks
>>
>> Eh? You use a connection string to connect to a database, but you say you already fetched the data and stored it in a DataSet? If so, the DataSet will contain one or more DataTable objects depending on how and what you fetched from the database. The DataTable object may have DataRow objects in its Rows property. The data will be inside these row objects.
>>
>> However, I suspect this is not what you mean. If you want to know how to retrieve data from a database and store it in a DataSet you typically use an SqlDataAdapter (or OleDBDataAdapter) and its Fill method. Or use SqlCommand.ExecuteReader (or OleDBCommand.ExecuteReader) and create a list of objects manually.
>>
>> --
>> Happy coding!
>> Morten Wennevik [C# MVP]
>
> Thanks, Morten
>
> We have some business logic in our DataObejcts/BusinessObjects (such
> as getting data by runing stored procedure, doing some checking
> up ...). Now we load a few tables data into dataset (we don't want to
> lock database for a long time), we want to use our DataObejcts/
> BusinessObjects against it as it against the orignal database. I think
> one way is contruct a connection string to connect to this dataset
> instead of the original database.
>
> Do you have any idea about this?
>
> Thanks very much.
>
>
>
>
>
You can transfer your database data to a temporary file and use OleDB queries against it. There is also the Select method of a DataTable and XPath queries on a DataSet
http://support.microsoft.com/kb/326176
http://msdn2.microsoft.com/en-us/library/89tyw6dw(vs.71).aspx
--
Happy coding!
Morten Wennevik [C# MVP]
Date:Tue, 31 Jul 2007 21:40:07 +0200
Author:
|
|
|