473,569 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Editable SQL05 XML in ASP.NET

What do people use when they want to pull XML from a SQL05 XML datatype column, edit it in an ASP.NET web app, and the post the updated XML back to SQL05?

I've looked into pulling the XML down into an XmlDataSource control, but this doesn't seem to be a very likely option as the bindings are readonly.

Seems like a common enough scenario--what have you done (those who have done this)?

I've tried pulling the SQL XML column down and place it in an XmlDocument, and then puting that into an XmlDataSource, but then I can't read it back out from there...

protected void Button1_Click(o bject sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@ "Data Source=.\SQLEXP RESS;Initial Catalog=SqlXmlT est;Integrated Security=True") ;
conn.Open();

string sql = "SELECT [Data] FROM [Record] WHERE ([UserId] = " + tbUserId.Text + ")";
SqlCommand comm = new SqlCommand(sql, conn);
XmlReader reader = comm.ExecuteXml Reader();
XmlDocument doc = new XmlDocument();
doc.Load(reader );

reader.Close();
conn.Close();

XmlDataSource1. Data = doc.OuterXml;
Repeater1.DataS ourceID = "XmlDataSource1 ";
}

protected void Button2_Click(o bject sender, EventArgs e)
{
string sql = "UPDATE [Record] SET [Data] = '" + XmlDataSource1. Data +"' WHERE ([UserId] = " + tbUserId.Text + ")";
Response.Write( sql);
}

The Button1 click works fine... but clicking Button2, XmlDataSource1. Data (which is supposed to be read/write) gives me an empty string.

In the web page, I bound the data to a text box control, so I could try editing it to see what would happen... but I just get a blank trying to read the Data property no matter what.

Ideas?

--
Greg Collins [Microsoft MVP]
Visit Braintrove ( http://www.braintrove.com )
Apr 26 '07 #1
0 1957

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

Similar topics

7
2155
by: ANC | last post by:
hi, i would like to ask how can i set a field of recordset to be editable? thanks in advance. ANC
17
3843
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a "table" insert in my "editable region", have it placed in the "center" of the page.. while it display correctly on my browser, with setting at...
2
604
by: sebastien roupin | last post by:
Dear all, i'm newbies to .net (VB) development and i've got a little question.(i use microsoft visual studio to develop but i can code also) i created a form with a comboxbox. When i launch it, the comboxbox is editable. I'd like it to be non-editable. Could you tell me what's the way to get it non-editable? (i'd like it to appear as a...
7
9317
by: deko | last post by:
SELECT tblTxAcct.TxAcctName, tblTxType.TxTypeName, Nz(qryTxAcctListCt.TxCount, 0) AS TxCt FROM (tblTxAcct INNER JOIN tblTxType ON tblTxAcct.TxType_ID=tblTxType.TxType_ID) LEFT JOIN qryTxAcctListCt ON tblTxAcct.TxAcct_ID=qryTxAcctListCt.TxAcct_ID; I use this query as a RecordSource for a Datasheet that displays Accounts, Types, and the...
4
1788
by: Stephan Bour | last post by:
Hi, I have a datagrid databound to a SQL query. I'd like to allow editing of some columns but not all. Is there a way to turn off the conversion of the datagrid cells to textboxes for some columns when the Edit button is pressed? Thank you, Stephan.
6
10617
by: Hako | last post by:
Hello All, I have a function to set readonly or editable of a textctrl. I'd like to make the textctrl initial set readonly and use other event funciton to set editable of the textctrl but it always can editable. How to set a textctrl can editable or readonly? Any Ideas? (see short snippet below) Thanks.
1
1061
by: John Bailo | last post by:
I just installed c# express and sql05 express. I don't see a query tool in the start menu -- but it says there is one installed in add/remove programs. Is there a "query analyzer" that comes with sql05expr ?
5
1224
by: Greg Collins [Microsoft MVP] | last post by:
What do people use when they want to pull XML from a SQL05 XML datatype column, edit it in an ASP.NET web app, and the post the updated XML back to SQL05? I've looked into pulling the XML down into an XmlDataSource control, but this doesn't seem to be a very likely option as the bindings are readonly. Seems like a common enough...
0
3475
by: muchinger | last post by:
All, I create 2 combo boxes on a page: an editable one and a non-editable one. Both of them have the same string items which are too long to entirely fit into the combo box. E. g. the size of the combo boxes is just large enough to display the half of the string "one word". Now when selecting the item "one word" in both combo boxes, the...
2
3039
by: sahista | last post by:
Hello. I create an iframe on the fly, set it to editable designMode='on' and insert into iframe.contentWindow.childNodes.childNodes some innerHTML. Ok... that all works fine in IE but in firefox it wont became editable neither insert the innerHTML!? I tried also set the onreadystatechange on iframe to for making it editable and set the...
0
7694
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...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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...
1
7666
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...
0
7964
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...
1
5504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
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...

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.