473,765 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>Micr osoft 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 2670
Han
Hello

Your question is a bit specific for this NG. From now on, use
microsoft.publi c.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("@myv ariable")}</publisher>
before (/book/title)[1]')
Instead of,
UPDATE docs
SET xCol.modify ('
insert <publisher>Micr osoft Press</publisher>
before (/book/title)[1]')

"Mukesh" <ef*****@newsgr oups.nospamwrot e in message
news:ef******** *****@TK2MSFTNG P06.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>Micr osoft 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>Micr osoft 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
13224
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: Hunter_69. Here is what the form looks like. I have the difficulty of inserting the multiple items selected by the user the first time he visits and uses the screen and then using an UPDATE when he visits later. Model | Original Price | Reduced Price...
8
5521
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, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Example: The Press Release section record would look like this: Username: John Doe Function Name: Press Release
10
3399
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 AddMinimunWageStipen(string payrollid,double amount) { System.Data.SqlClient.SqlConnection cn = null; System.Data.SqlClient.SqlCommand cm = null;
5
7042
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
4049
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 based on a parameter? Create PROCEDURE dbo.UpdateDetalleOT ( @eotId int, )
2
7053
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, input box for units of service, description of the service and each row has its own dropdown list of unit fees that apply. Each dynamically created row will return 3 values fee1_choice, fee1_unit and fee1_money. Note The above informaton is...
1
3035
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 tool. The problem I am having is that of inserting all the answers into the table. The questionnaire is Dynamic so the number of questions can vary. I have a variable that counts them so at the moment there is 75 questions.
2
5599
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 cal_date, holiday_ID from Calendar, holiday_tbl WHERE (((calendar.cal_Date) Between . And .)) And Email_sent=0 AND Staff_ID=" & Staff_ID This works fine.
58
8122
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 the parts section an i seem to be having trouble. When i try to insert into the parts section i get the error Invalid character value for cast specification. But not sure what i am doing wrong. Here is what i am using to insert. All the sections...
0
9568
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
9404
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
9835
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
8833
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
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
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
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.