public int InsertCompanyDetailsInformation(int companyId, int bankId, int accountNo, string accountType)
{
int rowsAffected = -1;
int returnValue;
try
{
SqlConnection con = DBProvider.GetDbConnection();
using (con)
{
con.Open();
SqlCommand objCmd = new SqlCommand("dbo.sp_InsertCompanyDetailsInformation", con);
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("#companyId", companyId);
objCmd.Parameters.AddWithValue("#bankId", bankId);
objCmd.Parameters.AddWithValue("#accountNo", accountNo);
objCmd.Parameters.AddWithValue("#accountType", accountType);
rowsAffected = objCmd.ExecuteNonQuery();
SqlParameter sqlParam = objCmd.Parameters.Add("#insert_flag", SqlDbType.Int);
objCmd.Parameters["#insert_flag"].Direction = ParameterDirection.ReturnValue;
returnValue = int.Parse(objCmd.Parameters["#insert_flag"].Value.ToString());
con.Close();
}
}
catch (Exception ex)
{
throw ex;
}
return rowsAffected;
}
and stored procedure
USE [SGTime_Development]
GO
/****** Object: StoredProcedure [dbo].[sp_InsertCompanyDetailsInformation] Script Date: 01/04/2011 14:31:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_InsertCompanyDetailsInformation]
(
#companyId int,
#bankId int,
#accountNo int,
#accountType varchar(50))
AS
BEGIN
SET NOCOUNT ON;
declare #insert_flag int;
if not exists(select AccountNo from [Company_Account_Details] where AccountNo=#accountNo)
begin
INSERT INTO [Company_Account_Details]
( Company_Id,
BankID,
AccountNo,
AccountType)
values
(#companyId,
#bankId,
#accountNo,
#accountType)
set #insert_flag=1;
END
else
begin
set #insert_flag=-1;
end
return #insert_flag;
end
I am getting error in the code i want return returnValue in InsertCompanyDetailsInformation Please help how we can return returnValue
You need to add parameter for return value before you execute the command. So you need to change code as below:
...
objCmd.Parameters.AddWithValue("#accountType", accountType);
// Add parameter for return value
SqlParameter sqlParam = objCmd.Parameters.Add("#insert_flag", SqlDbType.Int);
objCmd.Parameters["#insert_flag"].Direction = ParameterDirection.ReturnValue;
// now execute the command
rowsAffected = objCmd.ExecuteNonQuery();
// you should able to get return value now
returnValue = int.Parse(objCmd.Parameters["#insert_flag"].Value.ToString());
...
public int InsertCompanyDetailsInformation(int companyId, int bankId, int accountNo, string accountType)
{
int rowsAffected = -1;
int returnValue;
try
{
SqlConnection con = DBProvider.GetDbConnection();
using (con)
{
con.Open();
SqlCommand objCmd = new SqlCommand("dbo.sp_InsertCompanyDetailsInformation", con);
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("#companyId", companyId);
objCmd.Parameters.AddWithValue("#bankId", bankId);
objCmd.Parameters.AddWithValue("#accountNo", accountNo);
objCmd.Parameters.AddWithValue("#accountType", accountType);
rowsAffected = objCmd.ExecuteNonQuery();
SqlParameter sqlParam = objCmd.Parameters.Add("#insert_flag", SqlDbType.Int);
sqlParam.Direction = ParameterDirection.ReturnValue;
// now execute the command
objCmd.Parameters.Add(sqlParam);
con.Open();
rowsAffected = objCmd.ExecuteNonQuery();
con.Close();
returnvalue = (int)objCmd.Parameters["insert_flag"].Value;
}
}
catch (Exception ex)
{
throw ex;
}
return rowsAffected;
}
}
Related
I've created a stored procedure in SQL Server to check if username exists in the database:
CREATE PROCEDURE [dbo].[spCheckUsernameForAnswer]
#username VARCHAR(30)
AS
BEGIN
DECLARE #count INT
SELECT #count = COUNT(username)
FROM Users
WHERE [username] = #username
IF (#count = 1)
BEGIN
SELECT 1 AS ReturnCode
END
ELSE
BEGIN
SELECT 0 AS Returncode
END
END
Here is what I've done in Visual Studio Registration.aspx.cs.
I need to check if the username exists and if not to insert the required values into db to register a new user.
From the code below it keeps registering new users with the same username again and again.
Any idea what am I missing here?
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Guid newGUID = Guid.NewGuid();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("spCheckUsernameForAnswer", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter parausername = new SqlParameter("#username", TextBoxUN.Text);
cmd.Parameters.Add(parausername);
conn.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
if (Convert.ToBoolean(rdr["ReturnCode"]))
{
Label1.Text = "Username found";
}
else
{
Label1.Text = "not found";
}
}
conn.Close();
SqlConnection conn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
conn1.Open();
string insertQuery = "insert into [Users] (user_id, first_name, last_name, email, username, password) values (#user_id, #first_name, #last_name, #email, #username, #password)";
SqlCommand com = new SqlCommand(insertQuery, conn1);
com.Parameters.AddWithValue("#user_id", newGUID.ToString());
com.Parameters.AddWithValue("#first_name", TextBoxFname.Text);
com.Parameters.AddWithValue("#last_name", TextBoxLname.Text);
com.Parameters.AddWithValue("#email", TextBoxEmail.Text);
com.Parameters.AddWithValue("#username", TextBoxUN.Text);
com.Parameters.AddWithValue("#password", TextBoxPass.Text);
com.ExecuteNonQuery();
Response.Write("Registration successful");
conn1.Close();
}
}
catch (Exception ex)
{
Response.Write("Error:" + ex.ToString());
}
It's better use cmd.ExecuteScalar since the sp is returning either 1 or 0.
And it would be better to have the insert into db part in a separate method like RegisterUser method.
But the main thing is you need to call that method when it doesn't exist in db (in the else statement)
protected void Button1_Click(object sender, EventArgs e)
{
try
{
using(var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString))
{
using(var cmd = new SqlCommand("spCheckUsernameForAnswer", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("#username", TextBoxUN.Text));
conn.Open();
var returnCode = Convert.ToInt32(cmd.ExecuteScalar());
if(returnCode == 1)
{
Label1.Text = "Username found";
}
else
{
Label1.Text = "not found";
Register();
}
}
}
}
catch (Exception ex)
{
Response.Write("Error:" + ex.ToString());
}
}
private void RegisterUser()
{
try
{
var newGUID = Guid.NewGuid();
using(var conn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString))
{
conn1.Open();
string insertQuery = "insert into [Users] (user_id, first_name, last_name, email, username, password) values (#user_id, #first_name, #last_name, #email, #username, #password)";
using(var com = new SqlCommand(insertQuery, conn1))
{
com.Parameters.AddWithValue("#user_id", newGUID.ToString());
com.Parameters.AddWithValue("#first_name", TextBoxFname.Text);
com.Parameters.AddWithValue("#last_name", TextBoxLname.Text);
com.Parameters.AddWithValue("#email", TextBoxEmail.Text);
com.Parameters.AddWithValue("#username", TextBoxUN.Text);
com.Parameters.AddWithValue("#password", TextBoxPass.Text);
com.ExecuteNonQuery();
}
}
Response.Write("Registration successful");
}
catch (Exception exc)
{
//log the exception;
}
}
Try this not too sure why you used reader if i was you will handle everything in stored procedure
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Guid newGUID = Guid.NewGuid();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("spCheckUsernameForAnswer", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter parausername = new SqlParameter("#username", TextBoxUN.Text);
cmd.Parameters.Add(parausername);
conn.Open();
var userexsist = (bool)cmd.ExecuteScalar();
if (userexsist)
{
Label1.Text = "Username found";
conn.close();
}
else
{
Label1.Text = "not found";
string insertQuery = "insert into [Users] (user_id, first_name, last_name, email, username, password) values (#user_id, #first_name, #last_name, #email, #username, #password)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("#user_id", newGUID.ToString());
com.Parameters.AddWithValue("#first_name", TextBoxFname.Text);
com.Parameters.AddWithValue("#last_name", TextBoxLname.Text);
com.Parameters.AddWithValue("#email", TextBoxEmail.Text);
com.Parameters.AddWithValue("#username", TextBoxUN.Text);
com.Parameters.AddWithValue("#password", TextBoxPass.Text);
com.ExecuteNonQuery();
Response.Write("Registration successful");
conn.Close();
}
}
catch (Exception ex)
{
Response.Write("Error:" + ex.ToString());
}
}
You can manage it in stored procedure also. Find the solution:
USE [akhil_db]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Sp_Insert_AddUser]
(
#fname varchar(200),
#lname varchar(200),
#userName varchar(200),
#userEmail varchar(200),
#userPasword varchar(200),
#userType varchar(200),
#msg VARCHAR(100) OUT )
AS
BEGIN
SET NOCOUNT ON;
Declare #UserCount int;
SELECT #UserCount = COUNT(*) FROM user_master WHERE [user_name] = #userName or [user_email]=#userEmail;
IF(#UserCount > 0)
begin
Set #msg = 'User already exists';
end
ELSE
begin
Insert into user_master(
user_fname,
user_lname,
[user_name]
,[user_email]
,[user_pasword]
,user_type
)
values(
#fname,
#lname,
#userName
,#userEmail
,#userPasword
,#userType
)
SET #msg ='Registered Successfully'
END
END
Code behind c#
SqlCommand cmd = new SqlCommand("Sp_Insert_AddUser", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#fname", txtfname.Text);
cmd.Parameters.Add("#lname", txtlname.Text);
cmd.Parameters.AddWithValue("#userName", txtUserName.Text);
cmd.Parameters.AddWithValue("#userEmail", txtUserEmail.Text);
cmd.Parameters.AddWithValue("#userPasword", txtPass.Text);
cmd.Parameters.AddWithValue("#userType", ddlUserType.SelectedValue);
cmd.Parameters.Add("#msg", SqlDbType.Char, 500);
cmd.Parameters["#msg"].Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
string message = (string)cmd.Parameters["#msg"].Value;
lblMessage.Visible = true;
lblMessage.Text = message;
con.Close();
I'M USING HELPER CLASS VS. SOON I WILL SENT ALTERNATIVE SOLUTION
SqlHelper sho = new SqlHelper();
public bool alreadyexist()
{
string[] str = { "#catname", "#proname" };
string[] obj = { comboproductname.Text, comboitemname.Text };
SqlDataReader sdrr = sho.GetReaderByCmd("sp_item_alreadyex", str, obj);
if (sdrr.Read())
{
sdrr.Close();
sho.CloseConnection();
return true;
}
else
{
sdrr.Close();
sho.CloseConnection();
return false;
}
Stored procedure:
Create procedure [dbo].[sp_item_alreadyex]
#catname nvarchar(50),
#proname nvarchar(50)
as
begin
select *
from Item
where Item_Name = #proname and Category = #catname
end
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am having problem deleting user from table. I can insert the data from form to table but while deleting it only gives else statement result as "SOME ERRORS OCCURRED WHILE PROCESSING THE REQUEST". StaffID is auto increment. Please help.
Delete Button :
private void btnDeleteUser_Click(object sender, EventArgs e)
{
try
{
int result = uc.ManageUser(txtFullName.Text, txtAddress.Text, txtPhone.Text, txtEmail.Text, Convert.ToDateTime(dateTimePickerJoinedDate.Text), txtUserame.Text, txtPassword.Text, Convert.ToDateTime(dateTimePickerCreatedDate.Text), "D");
if (result == 1)
{
MessageBox.Show("User Deleted");
dgvUserDetails.DataSource = uc.SelectAllUsers();
//MakeFieldsBlank();
}
else
{
MessageBox.Show("SOME ERRORS OCCURRED WHILE PROCESSING THE REQUEST");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
}
}
ManageUser Class
public int ManageUser(String Name, String Address, String Phone, String Email, DateTime JoinedDate, String Username, String Password, DateTime CreatedDate, String Mode)
{
try
{
int result = 0;
SqlCommand cmd = new SqlCommand("sp_ManageUser", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#StaffID",DBNull.Value);
cmd.Parameters.AddWithValue("#Name", Name);
cmd.Parameters.AddWithValue("#Address", Address);
cmd.Parameters.AddWithValue("#Phone", Phone);
cmd.Parameters.AddWithValue("#Email", Email);
cmd.Parameters.AddWithValue("#JoinedDate", JoinedDate);
cmd.Parameters.AddWithValue("#Username", Username);
cmd.Parameters.AddWithValue("#Password", Password);
cmd.Parameters.AddWithValue("#CreatedDate", CreatedDate);
//cmd.Parameters.AddWithValue("#IsActive", IsActive);
cmd.Parameters.AddWithValue("#Mode", Mode);
conn.Open();
result = cmd.ExecuteNonQuery();
conn.Close();
return result;
}
catch (Exception ex)
{
throw ex;
}
}
Procedure : sp_ManageUser
USE [db_ProjectStatusManager]
GO
/****** Object: StoredProcedure [dbo].[sp_ManageUser] Script Date: 12/05/2014 01:29:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_ManageUser]
-- Add the parameters for the stored procedure here
#StaffID int,
#Name nvarchar(100),
#Address nvarchar(500),
#Phone nvarchar(100),
#Email nvarchar(100),
#JoinedDate date,
#Username nvarchar(50),
#Password nvarchar(max),
#CreatedDate date,
#Mode varchar(1)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT OFF;
-- Insert statements for procedure here
if(#Mode='I')
insert into tbl_Staff (Name,Address,Phone,Email,JoinedDate,Username,Password,CreatedDate) values(#Name,#Address,#Phone,#Email,#JoinedDate,#Username,#Password,#CreatedDate)
if(#Mode='U')
Update tbl_Staff set Name=#Name,Address=#Address,Phone=#Phone,Email=#Email,JoinedDate=#JoinedDate,Username=#Username,Password=#Password,CreatedDate=#CreatedDate where StaffID=#StaffID
if(#Mode='D')
Delete from tbl_Staff where StaffID=#StaffID
end
Load Users To TextBox
private void FrmUsers_Load(object sender, EventArgs e)
{
UserClass uc = new UserClass();
dgvUserDetails.DataSource = uc.SelectAllUsers();
dgvUserDetails.AllowUserToAddRows = false;
dgvUserDetails.AllowUserToOrderColumns = false;
panel1.Enabled = false;
}
UserClass. SelectAllUsers
public DataTable SelectAllUsers()
{
try
{
SqlCommand cmd = new SqlCommand("Select * from tbl_Staff", conn);
DataTable dt = new DataTable();
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
dt.Load(dr);
conn.Close();
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
You need to pass the value for the parameter #StaffID because the SP requires this parameter for the UPDATE and DELETE parts. It is only the INSERT part that doesn't require the #StaffID value
uc.ManageUser(txtStaffID.Text, txtFullName.Text, .......
....
public int ManageUser(string staffID, String Name, ......)
{
try
{
int result = 0;
SqlCommand cmd = new SqlCommand("sp_ManageUser", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#StaffID", Convert.ToInt32(staffID));
cmd.Parameters.AddWithValue("#Name", Name);
....
}
Of course this means that you need to save somewhere that value when you load your user data.
This could be a global variable or some textbox in readonly mode or hidden in your form or as a property of a User class. (This would a lot better. You could pass the whole instance of a User to your UserManager class instead of a lot of separated parameters)
Also pay attention to the datatype of the parameter #StaffID. The SP expects an integer not a string.
You are passing a NULL value in 'StaffID' column in command parameter but your store procedure has where condition with 'StaffID', first you need to Get the 'StaffID' and then pass the it.
you get the StaffID by simple query
Select StaffID from tbl_Staff where Name=#Name and Username = #Username ;
You can follow this code to get the Staffid
public int getstaffid()
{
int staffid = 0;
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
string query = " Select StaffID from tbl_Staff where Name=#Name and Username = #Username";
cmd.CommandText = query;
SqlParameter param = new SqlParameter("#Name", txtFullName.Text);
cmd.Parameters.Add(param);
SqlParameter param = new SqlParameter("#Username", txtUserame.Text);
cmd.Parameters.Add(param);
try
{
con.Open();
staffid= (Int32)cmd.ExecuteScalar();
return staffid;
}
catch (Exception ex)
{
throw;
}
}
And Now in ManagerUSer()
public int ManageUser(String Name, ......)
{
try
{
int Staffid = getstaffid();
int result = 0;
SqlCommand cmd = new SqlCommand("sp_ManageUser", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("#StaffID",Staffid);
cmd.Parameters.AddWithValue("#Name", Name);
....
}
}
I have a number in C# which is double longitude =1.041970849797e-05.
When I try to insert it into a decimal(9,6) column, I get the error message:
Error converting data type nvarchar to numeric
How do I correctly save the above as a decimal?
C# Application Code:
static void Main(string[] args)
{
double lat=1.041970849797e-05;
insertRecs(lat);
}
private static void insertRecs(double latitude)
{
Int32 rowsAffected = 0;
string connectionString = GetConnectionString();
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand cmd = new SqlCommand("dbo.usp_temp", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 90;
try
{
rowsAffected = cmd.ExecuteNonQuery();
}
catch (Exception ep)
{
Console.WriteLine("Exception in Insertrecords ");
Console.WriteLine(ep.Message);
}
}
}
SQL Stored Procedure:
create PROCEDURE [dbo].[usp_temp]
--The parameters for the stored procedure
#latitude decimal(9,6)
AS
BEGIN
insert into temptest(latitude) values(#latitude);
END
Looking at the sample of code you gave us you don't actually map the latitude variable when running the Stored Procedure.
You would need to add a couple of lines like so:
SqlParameter param = cmd.Parameters.Add("#latitude", SqlDbType.Decimal);
param.Direction = ParameterDirection.Input;
param.Value = latitude;
And edited into your code:
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand cmd = new SqlCommand("dbo.usp_temp", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandTimeout = 90;
// Map the parameters into the Stored Procedure
SqlParameter param = cmd.Parameters.Add("#latitude", SqlDbType.Decimal);
param.Direction = ParameterDirection.Input;
param.Value = latitude;
try
{
rowsAffected = cmd.ExecuteNonQuery();
}
catch (Exception ep)
{
Console.WriteLine("Exception in Insertrecords ");
Console.WriteLine(ep.Message);
}
}
I want to use a stored procedure in mySql and it must return identity_scope(). I try this but don't work:
CREATE DEFINER=`root`#`localhost` PROCEDURE `InsertVideo`(
OUT out_scope_id INT,
IN in_youtubeidvideo VARCHAR(15),
IN in_title VARCHAR(200),
IN in_rating DOUBLE,
IN in_viewcount INT
)
BEGIN
INSERT INTO Video
(
YoutubeIdVideo,
Title,
Rating,
ViewCount,
DataAdded,
ConvertedFlag
)
VALUES
(
in_youtubeidvideo,
in_title,
in_rating,
in_viewcount,
CURDATE(),
false
);
END
using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["AxWaveConnection"].ToString()))
{
try
{
conn.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
MySqlCommand cmd = new MySqlCommand("InsertVideo", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add("out_scope_id", scopeID);
cmd.Parameters.Add(new MySqlParameter("in_youtubeidvideo", VideoId));
cmd.Parameters.Add(new MySqlParameter("in_title", Title));
cmd.Parameters.Add(new MySqlParameter("in_viewcount", ViewCount));
cmd.Parameters.Add(new MySqlParameter("in_rating", Rating));
cmd.Parameters["out_scope_id"].Direction = ParameterDirection.Output;
try
{
cmd.ExecuteNonQuery();
scopeID = Convert.ToInt32(cmd.Parameters["out_scope_id"].Value);
}
catch (Exception)
{
scopeID = -1; //Duplicate Record
}
conn.Close();
}
You forgot to set the value of the parameter in your proc; the last line in your stored proc should read like this:
select out_scope_id = LAST_INSERT_ID();
BTW: SCOPE_IDENTITY() is a MS SQL Server function; not a MySQL function.
SELECT ##IDENTITY AS 'Identity';
GO
I would like to call a (Oracle) Procedure from C#. My Code:
try
{
OracleConnection myOracleConnection = new OracleConnection(connectionString);
myOracleConnection.Open();
OracleCommand command = myOracleConnection.CreateCommand();
command.CommandText = String.Format("BEGIN MISSINGTABLES ('{0}', '{1}'); END;", "PEKA_ERP_001", "ASE_ERP_001");
command.CommandType = System.Data.CommandType.Text;
command.ExecuteNonQuery();
myOracleConnection.Close();
}
catch (OracleException e)
{
throw e;
}
catch (Exception e)
{
throw e;
}
The Procedure:
CREATE OR REPLACE PROCEDURE MISSINGTABLES (S1 IN VARCHAR2, S2 IN VARCHAR2) AS
BEGIN [...]
on command.ExecuteNonQuery(); I get an Exception..:
PL/SQL: Statement ignored
OracleException Unhandled
What I'm doing wrong?
Did it :)
OracleCommand command = myOracleConnection.CreateCommand();
command.CommandText = "MISSINGTABLES";
command.Parameters.Add(new OracleParameter("S1", OracleType.VarChar)).Value = "PEKA_ERP_001";
command.Parameters.Add(new OracleParameter("S2", OracleType.VarChar)).Value = "ASE_ERP_001";
command.CommandType = System.Data.CommandType.StoredProcedure;
command.ExecuteNonQuery();
myOracleConnection.Close();