473,238 Members | 1,931 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,238 software developers and data experts.

To insert dynamic value in Xml

sir,
i am developing a database, which will store the users profile
both personal and professional
which includes the address, telephone, gender and etc.
in my main table i have created a column of xml data type. i was
successful in inserting the static
value inside my table.by following code:---
UPDATE docs
SET xCol.modify ('
insert <publisher>Microsoft Press</publisher>
before (/book/title)[1]')

since the profile of users vary from person to person, i cant insert
static value. i need to generate dynamic value.
the value which is inserted by user through text box should get inserted
in my main table .
kindly guide me.
Nov 24 '06 #1
3 2643
Han
Hello

Your question is a bit specific for this NG. From now on, use
microsoft.public.sqlserver.xml.

You seem to want to use sql variable within your XML DML. Right? Then,

Try
UPDATE docs
SET xCol.modify ('
insert <publisher>{sql:variable("@myvariable")}</publisher>
before (/book/title)[1]')
Instead of,
UPDATE docs
SET xCol.modify ('
insert <publisher>Microsoft Press</publisher>
before (/book/title)[1]')

"Mukesh" <ef*****@newsgroups.nospamwrote in message
news:ef*************@TK2MSFTNGP06.phx.gbl...
sir,
i am developing a database, which will store the users profile both
personal and professional
which includes the address, telephone, gender and etc.
in my main table i have created a column of xml data type. i was
successful in inserting the static
value inside my table.by following code:---
UPDATE docs
SET xCol.modify ('
insert <publisher>Microsoft Press</publisher>
before (/book/title)[1]')

since the profile of users vary from person to person, i cant insert
static value. i need to generate dynamic value.
the value which is inserted by user through text box should get inserted
in my main table .
kindly guide me.

Nov 25 '06 #2
Thanks for Han's input.

Hi Mukesh,

I'm wondering whether you're going to do the dynamic update XML at SQL
Server side (as Han has suggested) or in ASP.NET/.NET code logic? Based on
my understanding, since the udpate xml content may depend on the business
logic in application layer, it is proper to dynamically generate the XML
based SQL update statement in .NET/ASP.NET code logic.

Would you provide me some more examples of the possible update statements
that may be used according to different user profiles(like the below one)

=========
UPDATE docs
SET xCol.modify ('
insert <publisher>Microsoft Press</publisher>
before (/book/title)[1]')
===========

Generally, if we do the dynamic update statement generation in .NET code,
the idea is as below:

1. define a update statement template with a placeholder section (for the
dynamic generated XML content)

2. generate the dynamic XML update string and insert into the update
statement template in #1

3. execute the whole XML based upate statement

Also, if the XML string is very complex, you can consider use the
Sysetm.Xml classes (such as XmlDocument class) to help generate it.

#XML in the .NET Framework
http://msdn.microsoft.com/XML/Buildi...k/default.aspx

BTW, you mentioned that you'll let client user input the update content
through Textbox on page, correct? If so, in ASP.NET, the page will by
default validate any markup code in the postback data(and throw validation
exception). Therefore, if you want to allow client use input markup data
(like <data>....</data>), you need to turn off the request validation on
the certain page like:

<%@ Page Language="C#" ValidateRequest="false" %>
#How To: Prevent Cross-Site Scripting in ASP.NET
http://msdn.microsoft.com/library/de...us/dnpag2/html
/paght000004.asp
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 27 '06 #3
Hello Mukesh,

Have you got any further progress or ideas on this issue or does the
information in the previous messages helps a little? Please feel free to
post here if there is anything else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 30 '06 #4

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

Similar topics

3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
10
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
5
by: SSP | last post by:
Dear ASP.NETers, How would I insert multiple rows of data from a web form? Are there any tute's and stuff around. Couldn't find any myself. Thanks in advance. SSP
9
by: cavassinif | last post by:
I need to dynamic select a column in which insert a vale based on a parameter value, I have this code, but it throws an incorrect syntax error. How do I dinamically select a column to insert...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
1
by: javedna | last post by:
Can PHP help with the following as I have tried in the MYSQL Forums and cant get any help Thanks Nabz ---------------------------------------- Hi I am developing a PHP MYSQL questionnaire...
2
by: paulmitchell507 | last post by:
I think I am attempting a simple procedure but I just can't figure out the correct syntax. My asp (classic) page runs a SELECT query to obtain dates and ID's from 2 tables uSQL = "SELECT...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.