Does anyone know if you can use text command type syntax like the following to call a proc in VN.NET:
"{CALL procGetCustomer(?)}"
It works fine in C#, but can't seem to get it going in
VB.NET. Here's my proc call:
Code:
Call m_CallStoredProcedureTextCommadType(SQLSERVER_CONNECTION_STRING, "{CALL procGetCustomer(?)}")
And here's the procedure:
Code:
Public Sub m_CallStoredProcedureTextCommadType(ByVal strConnectionString As String, ByVal strText As String)
Dim cnn As New OleDbConnection(strConnectionString)
cnn.Open()
Dim cmd As OleDbCommand = cnn.CreateCommand()
With cmd
.CommandText = strText
.CommandType = CommandType.Text
.Parameters.Add("@CustomerID", OleDbType.WChar, 5)
.Parameters(0).Value = "ALFKI"
End With
Dim dr As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If dr.Read() Then
Console.WriteLine(dr("CompanyName"))
Else
Console.WriteLine("No customer found.")
End If
dr.Close()
End Sub
The stored procedure exists and works fin when called by Query Analyzer or my C# version of the procedure.
Thanks,
Bob