-
Jul 6th, 2017, 05:40 AM
#1
Thread Starter
New Member
Why Data Isn't being Inserted By XML into Table in the SQL server Database
Hey !!! why data isnt being inserted into Table in the SQL server ..when vb.net code works fine.. here is structure of stored procedure which i have created to inserted data through my vb.net application. I am passing XML data from vb.net application using sqlparamerters.
CREATE PROCEDURE [dbo].[upproductdetails]
@dttest XML
AS
BEGIN
SET NOCOUNT ON
SET XACt_Abort ON
BEGIN TRANSACTION
Begin
Insert into [productdetails](Product_Id, Product_Name, product_Price)
SELECT
D.dttest.value('./Product_Id[1]','nvarchar(15)') AS Product_Id,
D.dttest.value('./Product_Name[1]','nvarchar(15)') AS Product_Name,
D.dttest.value('./product_Price[1]','nvarchar(15)') AS product_Price
FROM @dttest.nodes('/DocumentElement/dttest') AS D(dttest)
END
SET XACt_Abort OFF
COMMIT TRANSACTION
END
-
Jul 6th, 2017, 07:09 AM
#2
Re: Why Data Isn't being Inserted By XML into Table in the SQL server Database
What does the XML look like?
If I had to guess... you've got a couple things wrong, but it depends on what your XML looks like.
-tg
- Also why are you casting your "price" field as nvarchar and not something reasonable like money or decimal?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|