473,657 Members | 2,436 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 2541
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.writexm l 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.writexm l 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.Strin gReader(CStr(Vi ewState("dsCust omers"))
DsCustomers1.Re adXml(sr
Els
SqlDataAdapter1 .Fill(DsCustome rs1
Dim sw as New System.IO.Strin gWriter(
DsCustomers1.Wr iteXml(sw
ViewState("dsCu stomers") = 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.writexm l 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.Strin gReader(CStr(Vi ewState("dsCust omers"))
DsCustomers1.Re adXml(sr
Els
SqlDataAdapter1 .Fill(DsCustome rs1
Dim sw as New System.IO.Strin gWriter(
DsCustomers1.Wr iteXml(sw
ViewState("dsCu stomers") = 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.writexm l 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.Strin gReader(CStr(Vi ewState("dsCust omers"))
DsCustomers1.Re adXml(sr
Els
SqlDataAdapter1 .Fill(DsCustome rs1
Dim sw as New System.IO.Strin gWriter(
DsCustomers1.Wr iteXml(sw
ViewState("dsCu stomers") = 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.writexm l 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.Strin gReader(CStr(Vi ewState("dsCust omers"))
DsCustomers1.Re adXml(sr
Els
SqlDataAdapter1 .Fill(DsCustome rs1
Dim sw as New System.IO.Strin gWriter(
DsCustomers1.Wr iteXml(sw
ViewState("dsCu stomers") = 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.writexm l 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.Strin gWriter
ds1.WriteXml(sw )
Dim mystring As String = sw.tostring
Dim sr As New System.IO.Strin gReader(mystrin g)
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("data set") = ds
End If
///
\\\
ds = DirectCast(View State("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.Strin gWriter
ds1.WriteXml(sw )
Dim mystring As String = sw.tostring
Dim sr As New System.IO.Strin gReader(mystrin g)
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("data set") = ds
End If
///
\\\
ds = DirectCast(View State("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.Strin gWrite
ds1.WriteXml(sw
Dim mystring As String = sw.tostrin
Dim sr As New System.IO.Strin gReader(mystrin g
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("data set") = d
End I
//
\\ ds = DirectCast(View State("dataset" ), DataSet
//

Nov 22 '05 #10

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

Similar topics

2
3046
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 to have an easier time understanding what I do. Therefore this weekend I'm going to spend 3 days just writing comments. Before I do it, I thought I'd ask other programmers what information they find useful. Below is a typical class I've...
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
7476
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 "System.Data.DataR..." is displayed inside the combobox is the amount of records in the dataset. On the other hand, if my query is "select emplcode from payemployee", the databind will work fine (but I don't want to limit the dataset to one field)....
8
2252
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 user deletes this value. Now, I want to update the DataSet (I know how to update the database) with a statement like this: r.MyDate = null. However, I can't seem to find the syntax to do this. Thanks!
3
3423
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 tell me to recreate the report as a lot of work has already been spent on this report.
3
3050
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. Then I click on SET LOCATION. When the list comes up, I already have the same dataset as the "CURRENT DATASET" and I have the same dataset in the tree control on the right as the default selection. I just click on REPLACE and close the dialog. But...
1
2857
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 the dataset into the database. the database has 5 columns and so does my dataset. my dataset has all the same name field name and datatype as the database. is there a possibility to merge the dataset in to the database? i was hoping there...
13
1823
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 DataView cause I do a lot of filtering) The problem is the primary key field (a unique counter), let's call it "TBL_ID".
12
1357
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 System.Windows.Forms.Form
0
8395
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.