G
Guest
I'm trying to call a stored procedure from vb.net that's on the sql server. I
would like to have the output on another form or a listbox where I can print
results. I'm not getting any errors, but i'm not getting any output either.
Any help appreciated. Thanks.
'Stored Procedure = COMPARE, Output = comp_out. COL001 is returned 'field
from SP.
Dim myCommand As New SqlCommand
Dim myParameter As SqlParameter
Dim myConnection = New SqlConnection("Integrated Security=SSPI;Packet
Size=4096;Data Source=TEST\MYSQL;Initial Catalog=hutty;Persist Security
Info=False;Workstation ID=TEST")
myCommand.Connection = myConnection
myCommand.CommandText = "COMPARE"
myCommand.CommandType = CommandType.StoredProcedure
myParameter = myCommand.CreateParameter()
myParameter.ParameterName = "@comp_out"
myParameter.Direction = ParameterDirection.Output
myParameter.SqlDbType = SqlDbType.VarChar
myParameter.Size = 50
myCommand.Parameters.Add(myParameter)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
Span1.Text =
Convert.ToString((myCommand.Parameters("@comp_out").Value.ToString()))
ListBox1.Items.Add(myCommand.Parameters("@comp_out").Value.ToString)
would like to have the output on another form or a listbox where I can print
results. I'm not getting any errors, but i'm not getting any output either.
Any help appreciated. Thanks.
'Stored Procedure = COMPARE, Output = comp_out. COL001 is returned 'field
from SP.
Dim myCommand As New SqlCommand
Dim myParameter As SqlParameter
Dim myConnection = New SqlConnection("Integrated Security=SSPI;Packet
Size=4096;Data Source=TEST\MYSQL;Initial Catalog=hutty;Persist Security
Info=False;Workstation ID=TEST")
myCommand.Connection = myConnection
myCommand.CommandText = "COMPARE"
myCommand.CommandType = CommandType.StoredProcedure
myParameter = myCommand.CreateParameter()
myParameter.ParameterName = "@comp_out"
myParameter.Direction = ParameterDirection.Output
myParameter.SqlDbType = SqlDbType.VarChar
myParameter.Size = 50
myCommand.Parameters.Add(myParameter)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
Span1.Text =
Convert.ToString((myCommand.Parameters("@comp_out").Value.ToString()))
ListBox1.Items.Add(myCommand.Parameters("@comp_out").Value.ToString)