473,503 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write Dataset to Database Field

Hi all,

I have a question on how can I write the entire Dataset to a NTEXT field of SQLServer.

Can anyone help me?

Thanks!

/mike

---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Nov 22 '05 #1
10 2518
Hi

I do not know if a NTEXT field is large enough, however to make a String
from a dataset you can use dataset GetXML.

One of my wishes is that there was a dataset SetXML because you while have
to loop through it as an XMLdoc to get it back to a dataset as far as I
know.

Or maybe Jon has a solution for that last as a specialis in my opinion for
serialization (I am seriously strugling with that Jon, maybe a nice chalenge
for you when you see this, I can also serialize it real as a datset with one
of the 3 schematypes in it, but also not deserialize that. Where I am not
talking about doing it with dataset.writexml and readxml via disk that is a
piece of cake).

Cor
Nov 22 '05 #2
Hi

I do not know if a NTEXT field is large enough, however to make a String
from a dataset you can use dataset GetXML.

One of my wishes is that there was a dataset SetXML because you while have
to loop through it as an XMLdoc to get it back to a dataset as far as I
know.

Or maybe Jon has a solution for that last as a specialis in my opinion for
serialization (I am seriously strugling with that Jon, maybe a nice chalenge
for you when you see this, I can also serialize it real as a datset with one
of the 3 schematypes in it, but also not deserialize that. Where I am not
talking about doing it with dataset.writexml and readxml via disk that is a
piece of cake).

Cor
Nov 22 '05 #3
> I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML
To quote SQL Server Books OnLine "NTEXT is Variable-length Unicode data with a maximum length of 230 - 1 (1,073,741,823) characters
One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know


Look at WriteXML/ReadXML of the dataset using StringReader. Here is an example from the MSDN documents

If Page.IsPostBack The
Dim sr as New System.IO.StringReader(CStr(ViewState("dsCustomers "))
DsCustomers1.ReadXml(sr
Els
SqlDataAdapter1.Fill(DsCustomers1
Dim sw as New System.IO.StringWriter(
DsCustomers1.WriteXml(sw
ViewState("dsCustomers") = sw.ToString(
End I

----- Cor Ligthert wrote: ----

H

I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML

One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know

Or maybe Jon has a solution for that last as a specialis in my opinion fo
serialization (I am seriously strugling with that Jon, maybe a nice chaleng
for you when you see this, I can also serialize it real as a datset with on
of the 3 schematypes in it, but also not deserialize that. Where I am no
talking about doing it with dataset.writexml and readxml via disk that is
piece of cake)

Co

Nov 22 '05 #4
> I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML
To quote SQL Server Books OnLine "NTEXT is Variable-length Unicode data with a maximum length of 230 - 1 (1,073,741,823) characters
One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know


Look at WriteXML/ReadXML of the dataset using StringReader. Here is an example from the MSDN documents

If Page.IsPostBack The
Dim sr as New System.IO.StringReader(CStr(ViewState("dsCustomers "))
DsCustomers1.ReadXml(sr
Els
SqlDataAdapter1.Fill(DsCustomers1
Dim sw as New System.IO.StringWriter(
DsCustomers1.WriteXml(sw
ViewState("dsCustomers") = sw.ToString(
End I

----- Cor Ligthert wrote: ----

H

I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML

One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know

Or maybe Jon has a solution for that last as a specialis in my opinion fo
serialization (I am seriously strugling with that Jon, maybe a nice chaleng
for you when you see this, I can also serialize it real as a datset with on
of the 3 schematypes in it, but also not deserialize that. Where I am no
talking about doing it with dataset.writexml and readxml via disk that is
piece of cake)

Co

Nov 22 '05 #5

oops that should be
"NTEXT is Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters

----- Jeff wrote: ----
I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML
To quote SQL Server Books OnLine "NTEXT is Variable-length Unicode data with a maximum length of 230 - 1 (1,073,741,823) characters
One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know


Look at WriteXML/ReadXML of the dataset using StringReader. Here is an example from the MSDN documents

If Page.IsPostBack The
Dim sr as New System.IO.StringReader(CStr(ViewState("dsCustomers "))
DsCustomers1.ReadXml(sr
Els
SqlDataAdapter1.Fill(DsCustomers1
Dim sw as New System.IO.StringWriter(
DsCustomers1.WriteXml(sw
ViewState("dsCustomers") = sw.ToString(
End I
----- Cor Ligthert wrote: ----

H

I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML

One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know

Or maybe Jon has a solution for that last as a specialis in my opinion fo
serialization (I am seriously strugling with that Jon, maybe a nice chaleng
for you when you see this, I can also serialize it real as a datset with on
of the 3 schematypes in it, but also not deserialize that. Where I am no
talking about doing it with dataset.writexml and readxml via disk that is
piece of cake)

Co

Nov 22 '05 #6

oops that should be
"NTEXT is Variable-length Unicode data with a maximum length of 2^30 - 1 (1,073,741,823) characters

----- Jeff wrote: ----
I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML
To quote SQL Server Books OnLine "NTEXT is Variable-length Unicode data with a maximum length of 230 - 1 (1,073,741,823) characters
One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know


Look at WriteXML/ReadXML of the dataset using StringReader. Here is an example from the MSDN documents

If Page.IsPostBack The
Dim sr as New System.IO.StringReader(CStr(ViewState("dsCustomers "))
DsCustomers1.ReadXml(sr
Els
SqlDataAdapter1.Fill(DsCustomers1
Dim sw as New System.IO.StringWriter(
DsCustomers1.WriteXml(sw
ViewState("dsCustomers") = sw.ToString(
End I
----- Cor Ligthert wrote: ----

H

I do not know if a NTEXT field is large enough, however to make a Strin
from a dataset you can use dataset GetXML

One of my wishes is that there was a dataset SetXML because you while hav
to loop through it as an XMLdoc to get it back to a dataset as far as
know

Or maybe Jon has a solution for that last as a specialis in my opinion fo
serialization (I am seriously strugling with that Jon, maybe a nice chaleng
for you when you see this, I can also serialize it real as a datset with on
of the 3 schematypes in it, but also not deserialize that. Where I am no
talking about doing it with dataset.writexml and readxml via disk that is
piece of cake)

Co

Nov 22 '05 #7
Hi Jeff,

This serializing works greath it is in my opinion I have narrowed it down to
\\\
Dim sw As New System.IO.StringWriter
ds1.WriteXml(sw)
Dim mystring As String = sw.tostring
Dim sr As New System.IO.StringReader(mystring)
Dim ds2 As New DataSet
ds2.ReadXml(sr)
///
Thanks, maybe it helps you when I say that your code to serialize for the
viewstate can in my opinion direct, it needs no serializer.

Try it, I do not know if it is faster.

However thank you very much again because I have long searched for this
simple solution of serialization a dataset to a string

Cor

For the viewstate, the session goes the same
\\\
If Not IsPostBack Then
ViewState("dataset") = ds
End If
///
\\\
ds = DirectCast(ViewState("dataset"), DataSet)
///
Nov 22 '05 #8
Hi Jeff,

This serializing works greath it is in my opinion I have narrowed it down to
\\\
Dim sw As New System.IO.StringWriter
ds1.WriteXml(sw)
Dim mystring As String = sw.tostring
Dim sr As New System.IO.StringReader(mystring)
Dim ds2 As New DataSet
ds2.ReadXml(sr)
///
Thanks, maybe it helps you when I say that your code to serialize for the
viewstate can in my opinion direct, it needs no serializer.

Try it, I do not know if it is faster.

However thank you very much again because I have long searched for this
simple solution of serialization a dataset to a string

Cor

For the viewstate, the session goes the same
\\\
If Not IsPostBack Then
ViewState("dataset") = ds
End If
///
\\\
ds = DirectCast(ViewState("dataset"), DataSet)
///
Nov 22 '05 #9
> Thanks, maybe it helps you when I say that your code to serialize for th
viewstate can in my opinion direct, it needs no serializer


Its definitely easier to set the reference directly but this was an example direct from the MSDN. Easy to copy and paste:

Performance wise though, its probably the same. When a dataset is asked to serialize/deserialize itself, it does it through XML serialization

----- Cor Ligthert wrote: ----

Hi Jeff

This serializing works greath it is in my opinion I have narrowed it down t
\\ Dim sw As New System.IO.StringWrite
ds1.WriteXml(sw
Dim mystring As String = sw.tostrin
Dim sr As New System.IO.StringReader(mystring
Dim ds2 As New DataSe
ds2.ReadXml(sr
//
Thanks, maybe it helps you when I say that your code to serialize for th
viewstate can in my opinion direct, it needs no serializer

Try it, I do not know if it is faster

However thank you very much again because I have long searched for thi
simple solution of serialization a dataset to a strin

Co

For the viewstate, the session goes the sam
\\ If Not IsPostBack The
ViewState("dataset") = d
End I
//
\\ ds = DirectCast(ViewState("dataset"), DataSet
//

Nov 22 '05 #10
> Thanks, maybe it helps you when I say that your code to serialize for th
viewstate can in my opinion direct, it needs no serializer


Its definitely easier to set the reference directly but this was an example direct from the MSDN. Easy to copy and paste:

Performance wise though, its probably the same. When a dataset is asked to serialize/deserialize itself, it does it through XML serialization

----- Cor Ligthert wrote: ----

Hi Jeff

This serializing works greath it is in my opinion I have narrowed it down t
\\ Dim sw As New System.IO.StringWrite
ds1.WriteXml(sw
Dim mystring As String = sw.tostrin
Dim sr As New System.IO.StringReader(mystring
Dim ds2 As New DataSe
ds2.ReadXml(sr
//
Thanks, maybe it helps you when I say that your code to serialize for th
viewstate can in my opinion direct, it needs no serializer

Try it, I do not know if it is faster

However thank you very much again because I have long searched for thi
simple solution of serialization a dataset to a strin

Co

For the viewstate, the session goes the sam
\\ If Not IsPostBack The
ViewState("dataset") = d
End I
//
\\ ds = DirectCast(ViewState("dataset"), DataSet
//

Nov 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3039
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
5
385
by: DotNetJunkies User | last post by:
Hi all, I have a question on how can I write the entire Dataset to a NTEXT field of SQLServer. Can anyone help me? Thanks! /mike
6
7469
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
8
2242
by: drg | last post by:
I have a DataSet with a DateTime field. I am using an EventRow r, to update it with values from a TextBox in a DataGrid. Suppose a DataGrid in edit mode had a field with value: 7/7/2005. Then the...
3
3413
by: Michelle Stone | last post by:
Hi all I recently changed the schema of a dataset (added one field, and changed another field type from STRING to DATE). I want this reflected in my Crystal Reports Designer. Please don't...
3
3044
by: Michelle Stone | last post by:
Thanks for your message I tried again and again... but didn't work. Can u please detail the exact steps to perform? This is what I do. In field explorer, i right-click the dataset to update....
1
2845
by: Asha | last post by:
greetings, i've manually created a dataset which contains data input from users. i validate the dataset against the business logic and once everything is done, i would like to save the values in...
13
1809
by: Lars Netzel | last post by:
hi! myDataSet that is fillled from an Access 2000 db and includes ONE table From that Table in myDataSet I create myDataView and use a Rowfilter to get a few rows that i work with (i need a...
12
1338
by: =?Utf-8?B?QW5kcmV3?= | last post by:
I am simple tryint to learn how to use the ADO.NET code. Can anybody tell me if I am using it right or not? Imports System.Data.sqlclient Imports System.Data Public Class Form1 Inherits...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4685
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.