C# and SQL Server - using a stored procedure - c#

I have three columns
Fraquence int
[Prochain étalonnag] date
[date étalonnage] type:date
In Visual Studio, I have a form for adding a new (etalonnage) to my table the user inputs two vules (Fraquence and date étalonnage).
I want to do this with a stored procedure in SQL Server :
Prochain étalonnag = date étalonnage + (Month Fraquence).
The column Prochain étalonnage will be filled automatically when the user click in button Add.

Please check following .NET code, sorry it is in VB.NET
But it is not a problem to convert it to C#
The stored procedure in database is named prAddRow for this sample
It accepts two parameters #p_int and #p_date
Dim sqlConnBuilder As New SqlConnectionStringBuilder()
sqlConnBuilder.DataSource = txtSQLServer.Text
sqlConnBuilder.InitialCatalog = txtDatabase.Text
sqlConnBuilder.IntegratedSecurity = True
conn = New SqlConnection(sqlConnBuilder.ToString)
Dim cmd As New SqlCommand("prAddRow")
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("#p_int", SqlDbType.Int).Value = 1
cmd.Parameters.Add("#p_date", SqlDbType.Date).Value = Date.Now.Date
conn.Open()
cmd.Connection = conn
Dim numberOfAffectedRows As Integer = cmd.ExecuteNonQuery()
conn.Close()
The T-SQL source codes for the sample stored procedure is as follows
create procedure prAddRow(
#p_int int,
#p_date date
)
as
insert into etalonnage (Fraquence , [date etalonnage] ) values (#p_int, #p_date)
go
Note: I renamed stored procedure according to marc's note from sp_addRow to prAddRow
I hope it is useful for you

private void button1_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("INSERTNEW", connection);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter [] par = new SqlParameter[4];
par[0] = new SqlParameter("#COD", SqlDbType.VarChar, 50);
par[0].Value = textBox1.Text;
par[1] = new SqlParameter("#FERQ", SqlDbType.Int);
par[1].Value = numericUpDown1.TextAlign;
par[2] = new SqlParameter("#DATE_ET", SqlDbType.Date);
par[2].Value = dateTimePicker1.Text;
par[3] = new SqlParameter("#DATE_PROC", SqlDbType.Date);
DateTime d1 = Convert.ToDateTime(dateTimePicker1.Text);
int k =Convert.ToInt32(numericUpDown1.TextAlign);
string r = d1.AddMonths(k).ToShortDateString();
par[3].Value = r ;
cmd.Parameters.AddRange(par);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
MessageBox.Show("good add");
}
this is work thanks all

Related

Trying to avoid duplicate entries for SQL insert from a CSV file import

I am trying to import CSV file data to a SQL Server Database. I got more than 15000 rows and it keeps adding new rows everyday to the CSV file. All i need is insert newly added rows to the already existing database.
Problem i have right now, if i import the file its gonna insert everything including old 15000 rows. I was thinking to to insert csv data to a temporary table and filter out duplicate lines. but i dont know how to do it.
private void Save_Import_Data_SQL(DataTable importData)
{
using(SqlConnection conn = new SqlConnection(myconnstring))
{
conn.Open();
foreach(DataRow importRow in importData.Rows)
{
DateTime Start_Date_tt = ConvertStringToDate(importRow["Start date"].ToString());
Decimal Start_Time_tt = ConvertStringToDecimal(importRow["Start time"].ToString());
DateTime Finish_Date_tt = ConvertStringToDate(importRow["Finish date"].ToString());
Decimal Finish_Time_tt = ConvertStringToDecimal(importRow["Finish time"].ToString());
Decimal Pieces_tt = ConvertStringToDecimal(importRow["Pieces"].ToString());
Decimal cycle_tt = ConvertStringToDecimal(importRow["Average part cycle time"].ToString());
Decimal length_tt = ConvertStringToDecimal(importRow["Length_pa"].ToString());
SqlCommand cmd = new SqlCommand("INSERT INTO Silver_Robot(Program_S,Grpup_S,Start_Date_S,Start_Time_S,Pieces_S,Finish_Date_S,Finish_Time_S,Average_Part_Cycle_Time_S,Mode_S,Length_S) VALUES(#program,#group,#start_Date,#start_time,#pieces,#finish_date,#finish_time,#avarage_part,#mode_p,#length_p)", conn);
cmd.Parameters.AddWithValue("#program", importRow["Program"]);
cmd.Parameters.AddWithValue("#group", importRow["Group"]);
cmd.Parameters.AddWithValue("#start_Date", Start_Date_tt);
cmd.Parameters.AddWithValue("#start_time", Start_Time_tt);
cmd.Parameters.AddWithValue("#pieces", Pieces_tt);
cmd.Parameters.AddWithValue("#finish_date", Finish_Date_tt);
cmd.Parameters.AddWithValue("#finish_time", Finish_Time_tt);
cmd.Parameters.AddWithValue("#avarage_part", cycle_tt);
cmd.Parameters.AddWithValue("#mode_p", importRow["Mode"]);
cmd.Parameters.AddWithValue("#length_p", length_tt );
cmd.ExecuteNonQuery();
}
}
}
Any help would be appreciated
You can just use IF NOT EXIST in SQL: https://forums.asp.net/t/1738957.aspx?SqlCommand+with+IF+NOT+EXISTS+statement
SQL Server Insert if not exist
So probably if you just replace your SQL command:
SqlCommand cmd = new SqlCommand("INSERT INTO Silver_Robot(Program_S,Grpup_S,Start_Date_S,Start_Time_S,Pieces_S,Finish_Date_S,Finish_Time_S,Average_Part_Cycle_Time_S,Mode_S,Length_S) VALUES(#program,#group,#start_Date,#start_time,#pieces,#finish_date,#finish_time,#avarage_part,#mode_p,#length_p)", conn);
With something like this:
SqlCommand cmd = new SqlCommand("IF NOT EXISTS (SELECT * FROM Silver_Robot WHERE Program_S = #program AND Grpup_S = #group AND Start_Date_S = #start_Date AND Start_Time_S = #start_time AND Pieces_S = #pieces AND Finish_Date_S = #finish_date AND Finish_Time_S = #finish_time AND Average_Part_Cycle_Time_S = #avarage_part AND Mode_S = #mode_p AND Length_S = #length_p) BEGIN INSERT INTO Silver_Robot(Program_S,Grpup_S,Start_Date_S,Start_Time_S,Pieces_S,Finish_Date_S,Finish_Time_S,Average_Part_Cycle_Time_S,Mode_S,Length_S) VALUES(#program,#group,#start_Date,#start_time,#pieces,#finish_date,#finish_time,#avarage_part,#mode_p,#length_p) END", conn);
it should work.
But, as you can see in the first link it might be a good idea to create a stored procedure, because in that case you'll have a better performance.
This is how i fixed it, and so far everything working perfectly fine.
I created a procedure
USE [Electrical_ENG]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Silver_Robot_Insert]
#program varchar(50),
#group varchar(50),
#start_Date datetime,
#start_time varchar(50),
#pieces decimal,
#finish_date datetime,
#finish_time varchar(50),
#avarage_part decimal,
#mode_p varchar(50),
#length_p decimal,
#Total_Time_p decimal
AS
DECLARE #err_msg nvarchar(255);
IF NOT EXISTS(SELECT * FROM Silver_Robot WHERE Program_S=#program AND Grpup_S=#group AND Start_Date_S=#start_Date AND Start_Time_S=#start_time AND Pieces_S=#pieces AND Finish_Date_S=#finish_date AND Finish_Time_S=#finish_time AND Average_Part_Cycle_Time_S=#avarage_part AND Mode_S=#mode_p AND Length_S=#length_p AND Total_Time_S=#Total_Time_p)
BEGIN
INSERT INTO Silver_Robot(Program_S,Grpup_S,Start_Date_S,Start_Time_S,Pieces_S,Finish_Date_S,Finish_Time_S,Average_Part_Cycle_Time_S,Mode_S,Length_S,Total_Time_S)
VALUES(#program,#group,#start_Date,#start_time,#pieces,#finish_date,#finish_time,#avarage_part,#mode_p,#length_p,#Total_Time_p)
END
Insert:
public void Insert_Silver_Robot(String Program_S, String Grpup_S, DateTime Start_Date_S, String Start_Time_S, Decimal Pieces_S, DateTime Finish_Date_S, String Finish_Time_S, double Average_Part_Cycle_Time_S, String Mode_S, double Length_S, double Total_Time_S)
{
using (SqlConnection conn = new SqlConnection())
{
conn.ConnectionString = con_str_S3;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "Silver_Robot_Insert";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#program", Program_S);
cmd.Parameters.AddWithValue("#group", Grpup_S);
cmd.Parameters.AddWithValue("#start_Date", Start_Date_S);
cmd.Parameters.AddWithValue("#start_time", Start_Time_S);
cmd.Parameters.AddWithValue("#pieces", Pieces_S);
cmd.Parameters.AddWithValue("#finish_date", Finish_Date_S);
cmd.Parameters.AddWithValue("#finish_time", Finish_Time_S);
cmd.Parameters.AddWithValue("#avarage_part", Average_Part_Cycle_Time_S);
cmd.Parameters.AddWithValue("#mode_p", Mode_S);
cmd.Parameters.AddWithValue("#length_p", Length_S);
cmd.Parameters.AddWithValue("#Total_Time_p", Total_Time_S);
//try
//{
conn.Open();
cmd.ExecuteNonQuery();
//}catch(Exception ex)
//{
// MessageBox.Show(ex.Message);
//}
//finally
//{
// if(con.State==ConnectionState.Open)
// {
conn.Close();
// }
// }
}
}
In upload click event:
foreach (DataRow importRow in importData.Rows)
{
DateTime Start_Date_tt = ConvertStringToDate(importRow["Start date"].ToString());
DateTime Finish_Date_tt = ConvertStringToDate(importRow["Finish date"].ToString());
Decimal Pieces_tt = ConvertStringToDecimal(importRow["Pieces"].ToString());
double cycle_tt = ConvertStringToDouble(importRow["Average part cycle time"].ToString());
double length_tt = ConvertStringToDouble(importRow["Length_pa"].ToString());
double total_time_tt = cycle_tt * length_tt;
string program_tt = importRow["Program"].ToString();
string group_tt = importRow["Group"].ToString();
string start_time_tt = importRow["Start time"].ToString();
string finish_time_tt = importRow["Finish time"].ToString();
string mode_tt = importRow["Mode"].ToString();
dbactions.Insert_Silver_Robot(program_tt,group_tt,Start_Date_tt,start_time_tt,Pieces_tt,Finish_Date_tt,finish_time_tt,cycle_tt, mode_tt,length_tt,total_time_tt);
}
Again using a bulkinsert would be the best way to do this but i do not have permission to use it in my server. And thanks for all the help.

Pass Array as parameter to Oracle stored proc from c# to bulk insert

I am trying to send arrays as parameter to Oracle stored proc in order to process bulk insert.
type Licensingentity_id is table of odilic_admin.licensingentity.licensingentity_id%type index by pls_integer;
type Nationalprovidernumber is table of odilic_admin.licensingentity.nationalprovidernumber%type index by pls_integer;
type Home_state_province_id is table of odilic_admin.licensingentity.home_state_province_id%type index by pls_integer;
procedure HomeStateLookup_bulk_insert(i_entityId in Licensingentity_id,
i_npn in Nationalprovidernumber,
i_homeStateId in Home_state_province_id) is
v_caller varchar2(60) := 'System_Scheduler';
begin
FORALL i IN 1 .. i_entityId.count
insert into home_state_lookup_stg
(licensingentity_id,
npn,
home_state_province_id,
isprocessed,
inserted_by,
inserted_date,
updated_by,
updated_date)
values
(i_entityId(i),
i_npn(i),
i_homeStateId(i),
0,
v_caller,
sysdate,
v_caller,
sysdate);
end HomeStateLookup_bulk_insert;
and here is the c# code
NiprConnectionString = ConfigurationManager.ConnectionStrings["ODI.NIPR.DB.Reader"].ConnectionString;
OracleConnection cnn = new OracleConnection(NiprConnectionString);
cnn.Open();
OracleCommand cmd = cnn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = NaicStateLookupRepositoryProcedures.HOME_STATE_BULK_INSERT;
cmd.BindByName = true;
cmd.ArrayBindCount = entities.Count;
var i_entityId = new OracleParameter();
var i_npn = new OracleParameter();
var i_homeStateId = new OracleParameter();
i_entityId.OracleDbType = OracleDbType.Int32;
i_npn.OracleDbType = OracleDbType.Varchar2;
i_homeStateId.OracleDbType = OracleDbType.Int32;
i_entityId.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
i_npn.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
i_homeStateId.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
i_entityId.Value = entities.Select(c => c.Key).ToArray();
i_npn.Value = entities.Select(c => c.Value.Item1).ToArray();
i_homeStateId.Value = entities.Select(c => c.Value.Item2).ToArray();
i_entityId.Size = entities.Count;
i_npn.Size = entities.Count;
i_homeStateId.Size = entities.Count;
cmd.Parameters.Add(i_entityId);
//cmd.Parameters[0].Value = i_entityId;
cmd.Parameters.Add(i_npn);
//cmd.Parameters[1].Value = i_npn;
cmd.Parameters.Add(i_homeStateId);
//cmd.Parameters[2].Value = i_homeStateId;
int result = cmd.ExecuteNonQuery();
but getting an exception -
ORA-06550: line 1, column 52: PLS-00103: Encountered the symbol ">"
when expecting one of the following:
( ) - + case mod new not null
Any help is much appreciated.
I can't promise this is the answer, and I don't have the tables you reference to test this for myself, but at first glance I noticed you set:
cmd.BindByName = true;
As such, I think you need to declare your parameter names:
var i_entityId = new OracleParameter("i_entityId");
var i_npn = new OracleParameter("i_npn");
var i_homeStateId = new OracleParameter("i_homeStateId");
I've never passed an array as a parameter to a procedure, but if you were to do this with a normal insert, it would look something like this:
string sql = "insert into foo values (:boo, :bar, :baz)";
OracleCommand cmd = new OracleCommand(sql, conn);
cmd.Parameters.Add(new OracleParameter("boo", OracleDbType.Varchar2));
cmd.Parameters.Add(new OracleParameter("bar", OracleDbType.Date));
cmd.Parameters.Add(new OracleParameter("baz", OracleDbType.Varchar2));
cmd.Parameters[0].Value = booArray;
cmd.Parameters[1].Value = barArray;
cmd.Parameters[2].Value = bazArray;
cmd.ArrayBindCount = booArray.Length;
cmd.ExecuteNonQuery();
I would start by defining the parameters with the parameter names, though.

C# is returning exception: Procedure has no parameters and arguments were supplied

I apologise for this formatting. I am new to programming and new to this site, so I will try and make the question as clear as possible.
I have a webform for accessing/modifying a Customer database. I have a button for entering new customers details which will automatically assign an ID number by getting the highest ID number from the database, and incrementing by one (and posting to form textbox).
This is the code I have written:
protected void btnNew_Click(object sender, EventArgs e)
{
Clear();
command.Connection = conn;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "NewCustomer";
conn.Open();
SqlParameter maxid = new SqlParameter();
maxid.ParameterName = "#MaxID";
maxid.SqlDbType = SqlDbType.Int;
maxid.Direction = ParameterDirection.Output;
command.Parameters.Add(maxid);
command.ExecuteNonQuery();
NewCustId = Convert.ToInt32(maxid.Value);
NewCustId += 1;
txtCustID.Text = (NewCustId).ToString();
txtCustID.DataBind();
conn.Close();
}
This is the stored procedure:
CREATE PROCEDURE NewCustomer
(#MaxID INT OUTPUT)
AS
BEGIN
SELECT #MaxID = MAX(CustID)
FROM dbo.Customer
END
I have tried many different ways of coding it, but nothing seems to work.
The code I have posted has an exception at ExecuteNonQuery saying arguments were supplied and procedure has no parameters. When I place command.Parameters.Add(maxid); underneath ExecuteNonQuery, it returns a 1.
I ran the SQL Query alone to see what would happen and it returns a correct answer in an unnamed cell. For some reason the Column Name disappears when it comes up. Then when I try to use the C# code to access the unnamed cell, I can't seem to access it because the column 'CustID' "doesn't exist".
With this code, I know that the SQL command is executing, and then the C# code increments by 1, but it seems that the return value I am getting is 0.
I appreciated any ideas that I can get on how to fix this. Thank you.
Edit: I have also tried:
DataTable table = new DataTable();
adapter.Fill(table);
NewCustId = table.Rows[0].Field("CustID");
(This is where it said 'CustID' column didn't exist)
Change your code to the following and try again:
Clear();
command.Connection = conn;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "NewCustomer";
conn.Open();
NewCustId = Convert.ToInt32(cmd.ExecuteScalar().ToString());
NewCustId += 1;
txtCustID.Text = NewCustId.ToString();
conn.Close();
And your stored procedure is:
CREATE PROCEDURE NewCustomer
(
)
AS
BEGIN
SELECT MAX(CustID)
FROM dbo.Customer;
END
ExecuteNonQuery() expects no results. Try ExecuteReader() instead.
I second what marc_S is saying about this running into issues.
Since you are using max ID and incrementing by 1 to insert a new record in the database, I suggest that you use Identity(seed, increment_value) for this column.
That way you don't have to find max to insert a new record and you avoid lots of transaction issues.
Once the transaction is done
Possible Design:
Create Table Customer
(
Id Int Identity(1,1),
Name varchar(50)
)
Create Proc NewCustomer
(
#Name varchar(50)
)
As
(
DECLARE #custID Int
SET NOCOUNT ON
INSERT INTO Customer (Name) Values('Your Name')
SET #custID = SCOPE_IDENTITY()
RETURN #custID
)
protected void btnNew_Click(object sender, EventArgs e)
{
Clear();
command.Connection = conn;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "NewCustomer";
conn.Open();
SqlParameter name = new SqlParameter();
name.ParameterName = "#Name";
name.Direction = ParameterDirection.Input;
name.SqlDbType = SqlDbType.Varchar;
name.Value = "Your Name";
command.Parameters.Add(name);
SqlParameter returnValue= new SqlParameter();
returnValue.ParameterName = "#custID";
returnValue.SqlDbType = SqlDbType.Int;
returnValue.Direction = ParameterDirection.ReturnValue;
command.Parameters.Add(maxid);
command.ExecuteNonQuery();
NewCustId = Convert.ToInt32(returnValue.Value);
txtCustID.Text = (NewCustId).ToString();
txtCustID.DataBind();
conn.Close();
}

'Procedure or function 'StoredProc' expects parameter '#variableInQuestion', which was not supplied' on variable formatted with a substring

I have the following stored proc that is throwing the aforementioned exception when I call it in a winform. The purpose of this form is to generate a number of randomized codes, format them, and store them in a database:
ALTER procedure [dbo].[StoredProc] (
#unimporantParam1 int,
#unimporantParam2 varchar(14),
#variableInQuestion varchar(10) OUT
)
As
Begin
exec dbo.GenerateRandomString 1,1,0,null,10,#variableInQuestion OUT
INSERT INTO [dbo].[sproc_table]
([unimportant_column1]
,[column_in_question]
,[unimportant_column2]
,[unimportant_column3]
,[unimportant_comlumn4])
SELECT #unimportantParam1
,(SELECT SUBSTRING(#variableInQuestion, 1, 3) + '-'
+ SUBSTRING(#variableInQuestion, 4, 4) + '-'
+ SUBSTRING(#variableInQuestion, 8, 3))
,GETDATE()
,0
,#unimportantVariable2
END
Being called by this C#:
private void btnGenerate_Click(object sender, EventArgs e)
{
int i;
var numberOfCodes = int.Parse(txtCodes.Text);
for (i = 1; i <= numberOfCodes; i++)
{
var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
conn.Open();
try
{
var command = new SqlCommand("StoredProc", conn)
{
CommandType = CommandType.StoredProcedure
};
command.Parameters.Add(new SqlParameter("#unimportantParam1", SqlDbType.Int, 0, "param1"));
command.Parameters.Add(new SqlParameter("#unimportantParam2", SqlDbType.VarChar, 14, "param2"));
command.Parameters[0].Value = txtUnimportant1.Text;
command.Parameters[1].Value = txtUnimportant2.Text;
command.ExecuteNonQuery();
}
finally
{
conn.Close();
conn.Dispose();
}
}
}
When I test it in SQL Server, it does what its supposed to, but when I test through the C# code, I get the above error. Can anyone tell me what I'm doing wrong with the substring formatting or if its something else causing the error. I appreciate any help that can be given.
When you create the variableInQuestion in your winForm you have to set it as a parameter without seeing your c# code I am assuming you have not done this, to do this the code looks like the following:
SqlParameter param = new SqlParameter();
SqlCommand cmd = new sqlCommand();
param = cmd.Parameters.Add("#variableInQuestion", SqlDbType.VarChar);
param.Direction = ParameterDirection.ReturnValue;
after when you execute your stored procedure it will store the returned value in the command
and you can access it using:
String someString = cmd.Parameters["#variableInQuestion"].Value.ToString();

A procedure data for a DataGridView

I have created a Windows Forms application in C# that will make use of a procedure in Oracle database.
In this form there is a DataGridView that I intend to bring the data through this procedure, but do not know what is missing in my code for this function, since it does not bring me any data. Below is the code of both:
Oracle procedure:
PROCEDURE P_TRANSFITENS(vID in NUMBER) is
cursor vAUX is
select t.pro_in_codigo,
t.alm_in_codigo,
t.loc_in_codigo,
u.loc_st_nome,
t.nat_st_codigo,
t.mvs_re_quantidade,
t.mvs_st_loteforne
from bd.est_movsumarizado t, bd.est_almoxlocal u
where t.pro_in_codigo = vID
and u.loc_in_codigo = t.loc_in_codigo;
rDadosItem vAUX%ROWTYPE;
begin
open vAUX;
loop
fetch vAUX
into rDadosItem;
exit when vAUX%NOTFOUND;
end loop;
close vAUX;
end;
C# (Button click handler):
OracleDataAdapter adp = new OracleDataAdapter();
OracleConnection objConn = new OracleConnection();
objConn.ConnectionString = "Data Source=dtsource;User Id=user;Password=pass";
objConn.Open();
adp.SelectCommand = new OracleCommand();
adp.SelectCommand.Connection = objConn;
adp.SelectCommand.CommandText = "P_TRANSFITENS";
adp.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
adp.SelectCommand.Parameters.Add("#vID", Convert.ToInt32(mskdId.Text));
DataTable dt = new DataTable();
adp.Fill(dt);
dtgrvDetalhesItem.DataSource = dt;
Thanks a lot!
P.S.: Sorry for my bad english.
I think the format should be like
PROCEDURE P_TRANSFITENS(vID in NUMBER, _RESULTS OUT SYS_REFCURSOR)
IS
BEGIN
OPEN _RESULTS FOR
select t.pro_in_codigo,
t.alm_in_codigo,
t.loc_in_codigo,
u.loc_st_nome,
t.nat_st_codigo,
t.mvs_re_quantidade,
t.mvs_st_loteforne
from bd.est_movsumarizado t, bd.est_almoxlocal u
where t.pro_in_codigo = vID
and u.loc_in_codigo = t.loc_in_codigo;
END P_TRANSFITENS;
Then you add this
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter refcursor = new OracleParameter("_RESULTS", OracleDbType.RefCursor);
refcursor.Direction = ParameterDirection.Output;
cmd.Parameters.Add(refcursor);
It seems to me that you aren't configure input/output params correctly.
try something like this:
OracleParameter param = cmd.Parameters.Add("vAUX", OracleDbType.RefCursor);
param.Direction = ParameterDirection.Output;
OracleParameter param2 = cmd.Parameters.Add("vID", OracleDbType.Int32);
param2.Direction = ParameterDirection.Input;
i'm unable to test it, but maybe, give it a try.

Categories