HighTechTalks DotNet Forums  

Saving a whole datatable to SQL server 2000

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Saving a whole datatable to SQL server 2000 in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Pipo
 
Posts: n/a

Default Saving a whole datatable to SQL server 2000 - 11-06-2007 , 02:18 PM






Hi,

I am looking for some sample (code) on how to save a complete datatable into
SQl server 2000.
I want to save the datatable (filled with datarows and values) and later on
I need to load it back again.

Does anyone know if this is possible and how?

tia,

Pipo


Reply With Quote
  #2  
Old   
Mansi Shah
 
Posts: n/a

Default Re: Saving a whole datatable to SQL server 2000 - 11-07-2007 , 05:14 AM







Hi,

For this you have to create 1 table in database through coding, can be
your datasets name. If you have table then you have to map the fields to
that table. Then you can retrive it from datatbase.

Regards,
Mansi Shah.

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #3  
Old   
pipo
 
Posts: n/a

Default Re: Saving a whole datatable to SQL server 2000 - 11-07-2007 , 10:00 AM



Hi Mansi,

Thank you for your reply.

I want to save the whole datatable to 1 record in de database.
The datatables I want to save and retrieve are different and not always the
same.
That is why I cant create tables for it in the database.

tia,
Pipo


"Mansi Shah" <mansi (AT) devdex (DOT) com> schreef in bericht
news:%23vplMcSIIHA.6068 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Quote:
Hi,

For this you have to create 1 table in database through coding, can be
your datasets name. If you have table then you have to map the fields to
that table. Then you can retrive it from datatbase.

Regards,
Mansi Shah.

*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #4  
Old   
Jim Rand
 
Posts: n/a

Default Re: Saving a whole datatable to SQL server 2000 - 11-07-2007 , 11:17 AM



Serialize the datatable to xml and save the resulting string in a varchar
field. If it's more than 8K characters, you will either have to compress it
and base64encode it (86% compression) or save it as a blob.

"pipo" <nomail (AT) me (DOT) com> wrote

Quote:
Hi Mansi,

Thank you for your reply.

I want to save the whole datatable to 1 record in de database.
The datatables I want to save and retrieve are different and not always
the same.
That is why I cant create tables for it in the database.

tia,
Pipo


"Mansi Shah" <mansi (AT) devdex (DOT) com> schreef in bericht
news:%23vplMcSIIHA.6068 (AT) TK2MSFTNGP05 (DOT) phx.gbl...

Hi,

For this you have to create 1 table in database through coding, can be
your datasets name. If you have table then you have to map the fields to
that table. Then you can retrive it from datatbase.

Regards,
Mansi Shah.

*** Sent via Developersdex http://www.developersdex.com ***





Reply With Quote
  #5  
Old   
Cor Ligthert[MVP]
 
Posts: n/a

Default Re: Saving a whole datatable to SQL server 2000 - 11-08-2007 , 12:53 AM



Jim,

That is the same as I thought, with the difference, that I would zip the XML
string and then add it to an bytearray (image/blob) field

Cor


Reply With Quote
  #6  
Old   
William Vaughn
 
Posts: n/a

Default Re: Saving a whole datatable to SQL server 2000 - 11-08-2007 , 01:35 PM



SSIS can do this. SqlBulkCopy can do this. BCP, DTS can also do this.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Pipo" <nomail (AT) me (DOT) pl> wrote

Quote:
Hi,

I am looking for some sample (code) on how to save a complete datatable
into SQl server 2000.
I want to save the datatable (filled with datarows and values) and later
on I need to load it back again.

Does anyone know if this is possible and how?

tia,

Pipo


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.