DateTime dtExpiry = DateTime.Now.AddDays(1);
CommonFunctionDAL objCommDAL = new CommonFunctionDAL();
SqlCommand cmd = new SqlCommand("sp_LoginCheck", sqlconnection);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("#UserName", emailid);
SqlParameter p2 = new SqlParameter("#Password", password);
cmd.Parameters.Add(p1);
cmd.Parameters.Add(p2);
SqlParameter sEMPID = cmd.Parameters.Add("#status", SqlDbType.Int, 5);
sEMPID.Direction = ParameterDirection.Output;
sqlconnection.Open();
SqlDataReader rd = cmd.ExecuteReader();
if (rd.HasRows)
{
rd.Read();
HttpCookie AppCookies = new HttpCookie("AppCookies");
AppCookies["EMPID"] = rd["EMPID"].ToString();
AppCookies["AEMPID"] = rd["AEMPID"].ToString();
AppCookies["EmpName"] = rd["EmpName"].ToString();
AppCookies["EmpDepartment"] = rd["EmpDepartment"].ToString();
AppCookies.Expires = dtExpiry;
HttpContext.Current.Response.Cookies.Add(AppCookies);
int Result = cmd.ExecuteNonQuery();
return sEMPID.Value.ToString();
}
I am getting enumeration yielded no results.
Related
In my application has been conflicts with the primary key constraint and a foreign key. I use stored procedures in a programming language c # and SqlDataReader. How to add data to the foreign keys in the database, that there was not primary key constraint. As the example of a way to organize this?
That my code for firstTable:
cmd = new SqlCommand(STORED_PREFIX + STORED_NAME2, connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#io", SqlDbType.Int);
cmd.Parameters["#io"].Direction = ParameterDirection.Input;
cmd.Parameters["#io"].Value = 1;
cmd.Parameters.Add("#idstud", SqlDbType.BigInt);
cmd.Parameters["#idstud"].Direction = ParameterDirection.Input;
cmd.Parameters["#idstud"].Value = id_studtextBox.Text;
cmd.Parameters.Add("#numb_stud", SqlDbType.Int);
cmd.Parameters["#numb_stud"].Direction = ParameterDirection.Input;
cmd.Parameters["#numb_stud"].Value = numberstudtextbox.Text;
cmd.Parameters.Add("#naim_corpus", SqlDbType.NVarChar);
cmd.Parameters["#naim_corpus"].Direction = ParameterDirection.Input;
cmd.Parameters["#naim_corpus"].Value = naimcorpuscombobox.Text;
cmd.Parameters.Add("#place", SqlDbType.Int);
cmd.Parameters["#place"].Direction = ParameterDirection.Input;
cmd.Parameters["#place"].Value = placetextbox.Text;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
dataGridView2.Rows.Add((string)rdr[_id_stud].ToString(),
(string)rdr[_nomer_stud].ToString(),
(string)rdr[_naim_corpus].ToString(),
(string)rdr[_mesto].ToString());
}
That code for secondTable
cmd = new SqlCommand(STORED_PREFIX + STORED_NAME2, connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#daw", SqlDbType.Int);
cmd.Parameters["#daw"].Direction = ParameterDirection.Input;
cmd.Parameters["#daw"].Value = 3;
cmd.Parameters.Add("#teachid", SqlDbType.BigInt);
cmd.Parameters["#teachid"].Direction = ParameterDirection.Input;
cmd.Parameters["#teachid"].Value = id_cabtextBox.Text;
cmd.Parameters.Add("#numb_teacher", SqlDbType.Int);
cmd.Parameters["#numb_teacher"].Direction = ParameterDirection.Input;
cmd.Parameters["#numb_teacher"].Value = numbercabtextbox.Text;
cmd.Parameters.Add("#naim_corpus", SqlDbType.NVarChar);
cmd.Parameters["#naim_corpus"].Direction = ParameterDirection.Input;
cmd.Parameters["#naim_corpus"].Value = naimcorpuscombobox.Text;
cmd.Parameters.Add("#studid", SqlDbType.Int);
cmd.Parameters["#studid"].Direction = ParameterDirection.Input;
cmd.Parameters["#studid"].Value = studidtextbox.Text;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
dataGridView2.Rows.Add((string)rdr[_teacher_id].ToString(),
(string)rdr[_nomer_teacher].ToString(),
(string)rdr[_naim_corpus].ToString(),
(string)rdr[_studid].ToString());
}
I swapped out the references but I am getting an error that it can't cast System.Oracle to Oracle.ManagedDataAccess
public static DataSet ExecuteDataSetWithTimeOut(string spName, object[] parameterValues)
{
OracleCommand cmd = new OracleCommand();
cmd.CommandTimeout = 7200;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = spName;
cmd.Parameters.Add("o_msg", OracleDbType.Varchar2, 300).Direction = ParameterDirection.Output;
cmd.Parameters.Add("o_shipper_inv", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
cmd.Parameters.Add("i_start_dt", OracleDbType.Date).Value = parameterValues[2].ToString();
cmd.Parameters.Add("i_end_dt", OracleDbType.Date).Value = parameterValues[3].ToString();
cmd.Parameters.Add("i_user_id", OracleDbType.Varchar2).Value = parameterValues[4].ToString();
cmd.Parameters.Add("i_facility_cd", OracleDbType.Varchar2).Value = null;
cmd.Parameters.Add("i_shipper_cd", OracleDbType.Varchar2).Value = null;
return Db.ExecuteDataSet(cmd);
}
I am trying to get data returned from my stored procedure. This is what I have tried and absolutely nothing is coming back.
Stored Proc:
Declare #Submit_ID as int
Set #Submit_ID = (Select (Max(Sub_ID) + 1) from Sub_Details);
INSERT INTO.....
Return #Submit_ID
C# (2.0)
SqlConnection conn = null;
int subid;
try
{
conn = new SqlConnection(conn_string);
SqlCommand cmd = new SqlCommand("INSERT_INTO_MYDB", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = new SqlParameter("#FirstName", SqlDbType.NVarChar, 255);
p1.Direction = ParameterDirection.Input;
p1.Value = txtFirstName.Text;
cmd.Parameters.Add(p1);
SqlParameter p2 = new SqlParameter("#LastName", SqlDbType.NVarChar, 255);
p2.Direction = ParameterDirection.Input;
p2.Value = txtLastName.Text;
cmd.Parameters.Add(p2);
SqlParameter pSub = new SqlParameter("#Sub_ID", SqlDbType.Int);
pSub.Direction = ParameterDirection.ReturnValue;
conn.Open();
cmd.ExecuteNonQuery();
subid = Convert.ToInt32(pSub);
}
You're not adding the return parameter to the command:
SqlParameter pSub = new SqlParameter("#Sub_ID", SqlDbType.Int);
pSub.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(pSub); // <------------- add to command
conn.Open();
cmd.ExecuteNonQuery();
subid = Convert.ToInt32(cmd.Parameters["pSub"].Value);
First add parameter to cmd and use .Value to its value
cmd.Parameters.Add(pSub); // add parameters to command
cmd.ExecuteNonQuery();
subid = Convert.ToInt32(pSub.Value); // Use .Value
So i am using a stored procedure to select a registry from a DB, the only thing the stored procedure does is SELECT ... The thing is that i use that stored procedure to fill a DataSet wich i return in my WebService. The problem comes when i want to send an exception instead of the DataSet, since the stored procedure checks on the DB and returns an empty row the DataSet fills with nothing and does not send me to an Exception ... Now, i save all my exceptions in a log table in the same DB ... My question is, can i go to the Exception block if the SELECT values are empty??
Here is my Code
[WebMethod(Description = "Private", EnableSession = false)]
public DataSet M812(string p_transaction)
{
string extran, enclosure, eDate;
try
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "dbo.sp_M812";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = p_transaction;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "Entradas");
con.Open();
cmd.ExecuteNonQuery();
con.Close();
cmd.Connection.Close();
return ds;
}
catch(SqlException Ex)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "dbo.sp_reqdataerrorlog";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#p_inTrans", SqlDbType.NChar, 12).Value = p_transaction;
cmd.Parameters.Add("#vo_enclosure", SqlDbType.VarChar, 250).Direction = ParameterDirection.Output;
cmd.Parameters.Add("#vo_trans", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
cmd.Connection.Close();
enclosure = "" + cmd.Parameters["#vo_enclosure"].Value;
extran = "" + cmd.Parameters["#vo_trans"].Value;
SqlConnection con2 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = con2;
cmd2.CommandText = "dbo.sp_errorlog";
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.Add("#p_inTrans", SqlDbType.NChar, 12).Value = p_transaction;
cmd2.Parameters.Add("#p_enclosure", SqlDbType.NChar, 6).Value = enclosure;
cmd2.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = extran;
cmd2.Parameters.Add("#p_method", SqlDbType.NChar, 6).Value = "812";
cmd2.Parameters.Add("#p_message", SqlDbType.NVarChar, 250).Value = "SQL Error: " + Ex.Message;
cmd2.Parameters.Add("#vo_message", SqlDbType.VarChar, 250).Direction = ParameterDirection.Output;
cmd2.Parameters.Add("#vo_errorDate", SqlDbType.DateTime).Direction = ParameterDirection.Output;
con2.Open();
cmd2.ExecuteNonQuery();
con2.Close();
cmd2.Connection.Close();
eDate = "" + cmd2.Parameters["#vo_errorDate"].Value;
SqlConnection con3 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd3 = new SqlCommand();
cmd3.Connection = con3;
cmd3.CommandText = "dbo.sp_selecterrorlog";
cmd3.CommandType = CommandType.StoredProcedure;
cmd3.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = p_transaction;
cmd3.Parameters.Add("#p_date", SqlDbType.DateTime).Value = eDate;
SqlDataAdapter da = new SqlDataAdapter(cmd3);
DataSet ds = new DataSet();
da.Fill(ds, "ErrorLog");
con3.Open();
cmd3.ExecuteNonQuery();
con3.Close();
cmd3.Connection.Close();
return ds;
}
catch (Exception Ex)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "dbo.sp_reqdataerrorlog";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#p_inTrans", SqlDbType.NChar, 12).Value = p_transaction;
cmd.Parameters.Add("#vo_enclosure", SqlDbType.VarChar, 250).Direction = ParameterDirection.Output;
cmd.Parameters.Add("#vo_trans", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
cmd.Connection.Close();
enclosure = "" + cmd.Parameters["#vo_enclosure"].Value;
extran = "" + cmd.Parameters["#vo_trans"].Value;
SqlConnection con2 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = con2;
cmd2.CommandText = "dbo.sp_errorlog";
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.Add("#p_inTrans", SqlDbType.NChar, 12).Value = p_transaction;
cmd2.Parameters.Add("#p_enclosure", SqlDbType.NChar, 6).Value = enclosure;
cmd2.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = extran;
cmd2.Parameters.Add("#p_method", SqlDbType.NChar, 6).Value = "812";
cmd2.Parameters.Add("#p_message", SqlDbType.NVarChar, 250).Value = "WEB Error: " + Ex.Message;
cmd2.Parameters.Add("#vo_message", SqlDbType.VarChar, 250).Direction = ParameterDirection.Output;
cmd2.Parameters.Add("#vo_errorDate", SqlDbType.DateTime).Direction = ParameterDirection.Output;
con2.Open();
cmd2.ExecuteNonQuery();
con2.Close();
cmd2.Connection.Close();
eDate = "" + cmd2.Parameters["#vo_errorDate"].Value;
SqlConnection con3 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd3 = new SqlCommand();
cmd3.Connection = con3;
cmd3.CommandText = "dbo.sp_selecterrorlog";
cmd3.CommandType = CommandType.StoredProcedure;
cmd3.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = p_transaction;
cmd3.Parameters.Add("#p_date", SqlDbType.DateTime).Value = eDate;
SqlDataAdapter da = new SqlDataAdapter(cmd3);
DataSet ds = new DataSet();
da.Fill(ds, "ErrorLog");
con3.Open();
cmd3.ExecuteNonQuery();
con3.Close();
cmd3.Connection.Close();
return ds;
}
}
Here is how you can check if the DataSet has any rows in any table:
bool hasRows = ds.Tables.Cast<DataTable>().Any(table => table.Rows.Count != 0);
Now you have a choice as to how to get the error data returned to the caller:
Pull out the error building logic into a separate method that your exception catch handler block and your if condition can both call, like this:
private void BuildAndReturnErrorDataSet()
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "dbo.sp_reqdataerrorlog";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("#p_inTrans", SqlDbType.NChar, 12).Value = p_transaction;
cmd.Parameters.Add("#vo_enclosure", SqlDbType.VarChar, 250).Direction = ParameterDirection.Output;
cmd.Parameters.Add("#vo_trans", SqlDbType.VarChar, 10).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
cmd.Connection.Close();
enclosure = "" + cmd.Parameters["#vo_enclosure"].Value;
extran = "" + cmd.Parameters["#vo_trans"].Value;
SqlConnection con2 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = con2;
cmd2.CommandText = "dbo.sp_errorlog";
cmd2.CommandType = CommandType.StoredProcedure;
cmd2.Parameters.Add("#p_inTrans", SqlDbType.NChar, 12).Value = p_transaction;
cmd2.Parameters.Add("#p_enclosure", SqlDbType.NChar, 6).Value = enclosure;
cmd2.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = extran;
cmd2.Parameters.Add("#p_method", SqlDbType.NChar, 6).Value = "812";
cmd2.Parameters.Add("#p_message", SqlDbType.NVarChar, 250).Value = "WEB Error: " + Ex.Message;
cmd2.Parameters.Add("#vo_message", SqlDbType.VarChar, 250).Direction = ParameterDirection.Output;
cmd2.Parameters.Add("#vo_errorDate", SqlDbType.DateTime).Direction = ParameterDirection.Output;
con2.Open();
cmd2.ExecuteNonQuery();
con2.Close();
cmd2.Connection.Close();
eDate = "" + cmd2.Parameters["#vo_errorDate"].Value;
SqlConnection con3 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CTSSQL"].ConnectionString);
SqlCommand cmd3 = new SqlCommand();
cmd3.Connection = con3;
cmd3.CommandText = "dbo.sp_selecterrorlog";
cmd3.CommandType = CommandType.StoredProcedure;
cmd3.Parameters.Add("#p_trans", SqlDbType.NChar, 18).Value = p_transaction;
cmd3.Parameters.Add("#p_date", SqlDbType.DateTime).Value = eDate;
SqlDataAdapter da = new SqlDataAdapter(cmd3);
DataSet ds = new DataSet();
da.Fill(ds, "ErrorLog");
con3.Open();
cmd3.ExecuteNonQuery();
con3.Close();
cmd3.Connection.Close();
return ds;
}
if(!hasRows)
{
// Call error data set building logic
BuildAndReturnErrorDataSet();
}
catch (Exception Ex)
{
// Call error data set building logic
BuildAndReturnErrorDataSet();
}
Raise exception if hasRows is false - not recommended as this is using exception handling to cause program control flow, but it technically will work.
I'm having difficulty trying to call my DBA's function inside C#. It works fine in the Oracle query browser, however when I attempt to execute it in C# it fails.
The most common error is : "ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1"
I've attempted to increase the size of the C# parameters but to no success. Not sure what I'm doing wrong.
C# Code :
string returnValue = string.Empty;
using (OracleConnection cn = new OracleConnection("ConnectionString"))
{
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = cn;
cmd.CommandText = "package.function";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter param1 = new OracleParameter();
OracleParameter param2 = new OracleParameter();
OracleParameter param3 = new OracleParameter();
OracleParameter param4 = new OracleParameter();
OracleParameter param5 = new OracleParameter();
param1.OracleDbType = OracleDbType.Varchar2;
param1.Direction = ParameterDirection.Input;
param1.Value = "Test808";
param1.ParameterName = "var1";
//param1.Size = 2000;
param2.OracleDbType = OracleDbType.Varchar2;
param2.Direction = ParameterDirection.Input;
param2.Value = "68B54814";
param2.ParameterName = "var2";
//param2.Size = 2000;
param3.OracleDbType = OracleDbType.Varchar2;
param3.Direction = ParameterDirection.Input;
param3.Value = "71839";
param3.ParameterName = "var4";
//param3.Size = 2000;
param4.OracleDbType = OracleDbType.Varchar2;
param4.Direction = ParameterDirection.Input;
param4.Value = 55 ;
param4.ParameterName = "var4";
//param4.Size = 2000;
param5.OracleDbType = OracleDbType.Varchar2;
param5.Direction = ParameterDirection.ReturnValue;
param5.ParameterName = "return";
//param5.Size = 2000;
cmd.Parameters.Add(param1);
cmd.Parameters.Add(param2);
cmd.Parameters.Add(param3);
cmd.Parameters.Add(param4);
cmd.Parameters.Add(param5);
try
{
cn.Open();
cmd.ExecuteNonQuery();
returnValue = cmd.Parameters["return"].Value.ToString();
}
catch
{
}
finally
{
cn.Close();
}
}
}
return returnValue;
Function Header:
FUNCTION create_rec
(p_mims_pallet_id varchar2
,p_item_no varchar2
,p_packer_id varchar2
,p_tare_wt varchar2
)
return varchar2
1st time trying Oracle calls. Never had an issue with SQL. The parameter.Size is commented out for not seeming to do anything.
Was able to get it working by removing the individual Parameters and creating them the Parameter.Add method.
Working Code:
string returnValue = string.Empty;
using (OracleConnection cn = new OracleConnection("ConString"))
{
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = cn;
cmd.CommandText = "package.function";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("rv", OracleDbType.Varchar2, 200, "", ParameterDirection.ReturnValue);
cmd.Parameters.Add("var1", OracleDbType.Varchar2, 20, "Test808", ParameterDirection.Input);
cmd.Parameters.Add("var2", OracleDbType.Varchar2, 20, "68B54814", ParameterDirection.Input);
cmd.Parameters.Add("var3", OracleDbType.Varchar2, 20, "71839", ParameterDirection.Input);
cmd.Parameters.Add("var4", OracleDbType.Decimal, 55, ParameterDirection.Input);
try
{
cn.Open();
cmd.ExecuteNonQuery();
returnValue = cmd.Parameters["rv"].Value.ToString();
}
catch
{
}
finally
{
cn.Close();
}
}
}
return returnValue;
I fixed this issue by changing its syntax. It was giving numeric or value overflow error if we use below syntax:
cmd.Parameters.Add("strSqlMsg", OracleDbType.Varchar2, 255, ParameterDirection.Output);
Which I changed to below and it worked.
cmd.Parameters.Add("strSqlMsg", OracleDbType.Varchar2, ParameterDirection.Output).Size=255;
Hope this will work for you.
Thanks.
Atul
string strRetrun = string.Empty;
using (OracleConnection objCon = (OracleConnection)_connection)
{
using (OracleCommand objCom = new OracleCommand())
{
objCom.Connection = objCon;
objCom.CommandText = "SAM.PKG_SAM_ECH.F_FUND_TRANSFER_TYPE";
objCom.CommandType = CommandType.StoredProcedure;
OracleParameter codeReturn = new OracleParameter("RETURN", OracleType.VarChar, 1000);
codeReturn.Direction = ParameterDirection.ReturnValue;
OracleParameter code1 = new OracleParameter("V_RECORD_ID", OracleType.Number);
code1.Direction = ParameterDirection.Input;
if (obj.RecordId != null)
code1.Value = obj.RecordId;
else
code1.Value = DBNull.Value;
OracleParameter code2 = new OracleParameter("V_DEBIT_APAC", OracleType.VarChar, 200);
code2.Direction = ParameterDirection.Input;
if (obj.P_BENEF_APAC != null)
code2.Value = obj.P_BENEF_APAC;
else
code2.Value = DBNull.Value;
OracleParameter code3 = new OracleParameter("V_ACCOUNT_TYPE", OracleType.VarChar, 200);
code3.Direction = ParameterDirection.Input;
if (obj.BenfAccType != null)
code3.Value = obj.BenfAccType;
else
code3.Value = DBNull.Value;
OracleParameter code4 = new OracleParameter("V_IFSC_CODE", OracleType.VarChar, 200);
code4.Direction = ParameterDirection.Input;
if (obj.IFSC != null)
code4.Value = obj.IFSC;
else
code4.Value = DBNull.Value;
objCom.Parameters.Add(codeReturn);
objCom.Parameters.Add(code1);
objCom.Parameters.Add(code2);
objCom.Parameters.Add(code3);
objCom.Parameters.Add(code4);
try
{
objCon.Open();
objCom.ExecuteNonQuery();
strRetrun = objCom.Parameters["RETURN"].Value.ToString();
}
catch
{
}
finally
{
objCon.Close();
}
}
}
return strRetrun;
To everybody who is wondering why the answer from Tim B is working.
It's the order of the parameters!
The return parameter of the function has to be bound first!
Also for the other Parameters the order counts and not the name.
The first version with creating the parameters individually, would be OK if "param5" would have been added as first object in to the collection.
I got stuck on this for while :-(