存储过程的实例:
PROCEDURE TEST_C(temp out varchar2,a INvarchar2,b in varchar2)
IS
BEGIN
temp:=a || b;
END;
调用方法:
说明:要在程序开头加入Imports System.Data.OleDb
Dim dbConn As New OleDbConnection
Dim dbComm As OleDbCommand
dbConn.ConnectionString = "Provider=MSDAORA.1;User ID=xxx;Password=xxx;Data Source=xxx;"
dbConn.Open()
dbComm = dbConn.CreateCommand
dbComm.Parameters.Add("temp",OleDbType.VarChar,30).Direction = ParameterDirection.Output
dbComm.Parameters.Add("a",30).Direction = ParameterDirection.Input
dbComm.Parameters("a").Value = "test "
dbComm.Parameters.Add("b",30).Direction = ParameterDirection.Input
dbComm.Parameters("b").Value = "OK"
dbComm.CommandText = "{CALL TEST_C(?,?,?)}" '这里就是使用"?"来代替参数
dbComm.CommandType = CommandType.Text
dbComm.ExecuteNonQuery()
dbConn.Close()
MessageBox.Show(dbComm.Parameters("temp").Value)