Dela via


Visual Basic Code Listing for ExecUDF

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

The following code creates ExecUDF.

  Dim proxy As New server.sql_endpoint
  Dim response As New Object
  Dim resultXml As System.Xml.XmlElement
  Dim errorMessage As server.SqlMessage
  Dim outputParam As System.Int32
  Dim param
  Dim i As System.Int16
  Dim rowCount As server.SqlRowCount
  Dim outParam As server.SqlParameter

  ListBox1.Items.Add("1) Executing UDFReturning scalar. Result returned as int ")
  ListBox1.Items.Add("")
  param = TextBox1.Text
  proxy.Credentials = System.Net.CredentialCache.DefaultCredentials
  Dim result As System.Int16
  result = proxy.UDFReturningAScalar()
  ListBox1.Items.Add("UDF Return value ")
  ListBox1.Items.Add(result)