SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Script task + xml imput


Script task + xml imput

Author
Message
chatwithkrishan
chatwithkrishan
SSC Journeyman
SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)SSC Journeyman (94 reputation)

Group: General Forum Members
Points: 94 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 ?
CozyRoc
CozyRoc
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2358 Visits: 2235
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/


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search