Scheduling a FORXML Stored Procedure

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

Hi,
I am not sure that this is the right place to post. I
currently have a Windows forms app that uses a command
button to execute a forxml stored procedure and drop the
output to a file. This, in turn, initiates a BizTalk
orchestration schedule. I would like to remove this
command button from the form and run its procedure as a
separate component, to be scheduled by Windows Task
Manager. The code for the routine is below:

Imports System.Xml

Dim cnSA As SqlClient.SqlConnection

Dim sqlCmd As SqlClient.SqlCommand

Public Const strConn As String = "packet
size=4096;integrated security=SSPI;data
source=JTDEVELOPER\SQLSRV;persist security
info=False;initial catalog=SA2002SQL"

Private Sub GetXMLOutput()
cnSA.ConnectionString = strConn
With sqlCmd
.CommandType = CommandType.StoredProcedure
.CommandText
= "procXMLEXPL_Pri_837P_Trans_to_BTS"
.Connection = cnSA
.CommandTimeout = 30

Dim doc As XmlDocument = New XmlDocument
cnSA.Open()

Dim myXmlReader As XmlTextReader
= .ExecuteXmlReader()

myXmlReader.WhitespaceHandling =
WhitespaceHandling.None
doc.Load(myXmlReader)

' close the XmlReader when finished.
myXmlReader.Close()

cnSA.Close()
doc.Save("D:\BTS Test Instances\priclaim
in\ForOutbound837.xml")
End With

End Sub

I guess what I need to do is encapsulate this sub into
something I can then turn into an .exe. Can anyone tell
me how to go about this? Thanks.
JT
 
Hi,

Thanks for your post. You are right that you need to create a .exe which
executes the code in GetXMLOutput(). I suggest that you can create a .NET
Console applicaiton, call the GetXMLOutput() method in the Main() function.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top