TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sivakumar
NA
551
217.9k
how to insert data in database using xml format
Apr 5 2016 3:57 AM
Hi,
This is my stored procedure :
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROC [dbo].[SpConformOrder]
@UserID INT,
@TemplateID INT,
@Price MONEY,
@Address XML,
@Placeholder XML
AS
BEGIN
DECLARE @OrderID INT
INSERT INTO [tblOrder]
([UserID]
,[TemplateID]
,[Price]
,[Status])
VALUES
(@UserID
,@TemplateID
,@Price
,1)
SET @OrderID=@@IDENTITY;
INSERT INTO tblOrderAddress (OrderID,AddressID)
SELECT @OrderID,
Pers.value('(addressID)[1]', 'int') as 'AddressID'
FROM
@Address.nodes('/addresses/adderss') as Addresses(Pers)
INSERT INTO [dbo].[tblPlaceHolder](OrderID,TemplateID,PlaceHolderOrderID,Type, Value)
SELECT @OrderID,
Pers.value('(templateID)[1]', 'int') as 'TemplateID',
Pers.value('(placeholderOrderID)[1]', 'int') as 'PlaceHolderOrderID',
Pers.value('(Type)[1]', 'Varchar(10)') as 'Type',
Pers.value('(Value)[1]', 'Varchar(max)') as 'Value'
FROM
@Placeholder.nodes('/placeholders/placeholder') as Placeholders(Pers)
END
I want to insert template data in xml format.
This is my sample template :
When click on save I want to save template details like image , placeholder2 and placeholder 3 text values in my database using xml format.
Please give me a code for that.
Thanks.
Reply
Answers (
2
)
c# Error converting data type varchar to numeric.
Retrieve image from database using uploaded file path