I am new to using Teradata and am trying to use it with vb.net to build a user app.
Can anyone please tell me how to call a teradata sp from vb.net (Visual Studio 2005)
I have a simple sp with input and output parameters, something like:
REPLACE PROCEDURE dbname.spname (IN inputnumber Integer, OUT outputnumber Integer)
SELECT COUNT(ITEM) INTO outputnumber
WHERE ITEM = inputnumber;
In teradta sql assitant I can call this using: call dbname.spname ('10',outputnum);
However in .Net I have tried different ways to call this sp but keep getting errors such as:
[Teradata Database] Invalid session mode for procedure execution.
Here is a sample function similar to what I am using, am I doing something wrong here?
Public Function TestFunction(ByVal TestNum) As Boolean
Dim Sql As String
Dim ResultSet As New ArrayList
Sql = "CALL dbname.spname(?,?);"
Using cn As OleDbConnection = New OleDbConnection(TeradataApp.ConnectionString)
Dim cmd As OleDbCommand = New OleDbCommand(Sql, cn)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("inputnumber", OleDbType.Integer).Value = TestNum
cmd.Parameters("outputnumber").Direction = ParameterDirection.Output
ResultSet = GetArrayList(cmd.ExecuteReader, True)