Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Script task + xml imput Expand / Collapse
Author
Message
Posted Wednesday, April 29, 2009 4:35 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, January 11, 2013 6:50 AM
Points: 38, Visits: 292
Public Sub Main()
sqlconn = New SqlConnection("data source=ss;initial catalog=ss;uid=sa;pwd=sa")
sqlcmdFinal = New SqlCommand("test", sqlconn)
sqlcmdFinal.CommandType = CommandType.StoredProcedure
sqlparam_XML_Record = New SqlParameter("@ReXML", SqlDbType.Xml)
Dim xm As Xml.XmlDocument = New Xml.XmlDocument()
Dim Str As String = Dts.Variables("t").Value.ToString()
xm.LoadXml(Str)
sqlparam_XML_Record.Value = xm.InnerXml
sqlcmdFinal.Parameters.Add(sqlparam_XML_Record)
'sqlparam_XML_Record.Value = Dts.Variables("t").Value
sqlconn.Open()
sqlcmdFinal.ExecuteNonQuery()
sqlconn.Close()
Dts.TaskResult = Dts.Results.Success
End Sub

Str string got xml file ( < field1>1< /field1>)

when i run package i got
ERROR :Failed to convert parameter value from a XmlDocument to a String.


how to resolve ?
Post #706623
Posted Wednesday, April 29, 2009 5:04 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Sunday, September 14, 2014 3:17 PM
Points: 1,118, Visits: 2,224
chatwithkrishan (4/29/2009)
Public Sub Main()
sqlconn = New SqlConnection("data source=ss;initial catalog=ss;uid=sa;pwd=sa")
sqlcmdFinal = New SqlCommand("test", sqlconn)
sqlcmdFinal.CommandType = CommandType.StoredProcedure
sqlparam_XML_Record = New SqlParameter("@ReXML", SqlDbType.Xml)
Dim xm As Xml.XmlDocument = New Xml.XmlDocument()
Dim Str As String = Dts.Variables("t").Value.ToString()
xm.LoadXml(Str)
sqlparam_XML_Record.Value = xm.InnerXml
sqlcmdFinal.Parameters.Add(sqlparam_XML_Record)
'sqlparam_XML_Record.Value = Dts.Variables("t").Value
sqlconn.Open()
sqlcmdFinal.ExecuteNonQuery()
sqlconn.Close()
Dts.TaskResult = Dts.Results.Success
End Sub

Str string got xml file ( < field1>1< /field1>)

when i run package i got
ERROR :Failed to convert parameter value from a XmlDocument to a String.

how to resolve ?


Can you debug the script and tell us on which line it fails?


---
SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

Post #706650
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse