473,387 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2507
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.