FederalProgrammer
Programmer
Here's my super simple Stored procedure in SQL-Server:
I call this stored procedure from vb.NET code like so:
I put a break point by the line:
storedProcCaller seems to have all of its parameters set along with valid values. However, the mentioned line above, breaks and following exception occurs:
"sp_AccountBalance" expects a paramter '@Email' which was not provided...
Any ideas??
---------------
Code:
CREATE PROCEDURE sp_AccountBalance (@Email varchar(255), @Balance money OUT) AS
SELECT @Balance = tblBands.accountBalance
FROM tblBands INNER JOIN tblUsers ON tblBands.ID = tblUsers.bandID
Where tblUsers.Email = @Email
I call this stored procedure from vb.NET code like so:
Code:
Dim storedProcCaller As New OdbcCommand("sp_AccountBalance", Me._cn)
storedProcCaller.CommandType = CommandType.StoredProcedure
'----------------------------------------
'Creating/Adding Input parameter:
Dim inParam As New OdbcParameter
inParam.ParameterName = "@Email"
inParam.Value = "Some Value"
inParam.OdbcType = OdbcType.VarChar
inParam.Direction = ParameterDirection.Input
storedProcCaller.Parameters.Add(inParam)
'----------------------------------------
'Creating/Adding output parameter:
Dim outParam As New OdbcParameter
outParam.ParameterName = "@Balance"
outParam.Value = Nothing
outParam.OdbcType = OdbcType.Double
outParam.Direction = ParameterDirection.Output
storedProcCaller.Parameters.Add(outParam)
'Calling the stored procedure:
Me.OpenConnection()
storedProcCaller.ExecuteNonQuery()
Me.CloseConnection()
I put a break point by the line:
Code:
storedProcCaller.ExecuteNonQuery()
storedProcCaller seems to have all of its parameters set along with valid values. However, the mentioned line above, breaks and following exception occurs:
"sp_AccountBalance" expects a paramter '@Email' which was not provided...
Any ideas??
---------------