Hello, Everyone.
I have receive the above mention error. I don't why this error is occurring.
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace TurnkeySolutions.App_Code.DAL
{
[Serializable]
public class DBBridge
{
public DBBridge()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// [METHOD] connect to the db
/// </summary>
/// <returns>TRUE, if it is saved</returns>
public static string DBConnection()
{
try
{
return System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
}
catch (Exception ce)
{
throw new ApplicationException("Unable to get DB Connection string from Config File. Contact Administrator" + ce);
}
}
public int ExecuteNonQuery(string storedProcedure, SqlParameter[] param)
{
try
{
return SqlHelper.ExecuteNonQuery(DBConnection(), CommandType.StoredProcedure, storedProcedure, param);
}
catch (SqlException sq)
{
throw sq;
}
}
public int ExecuteNonQuerywithTrans(string storedProcedure, SqlParameter[] param)
{
SqlConnection conTrans = new SqlConnection(DBConnection());
SqlTransaction sqlTrans;
conTrans.Open();
int returnResult = 0;
using (sqlTrans = conTrans.BeginTransaction())
{
try
{
returnResult = SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, storedProcedure, param);
sqlTrans.Commit();
return returnResult;
}
catch (Exception sq)
{
sqlTrans.Rollback();
throw sq;
}
finally
{
conTrans.Close();
}
}
}
public int ExecuteNonQuery(string storedProcedure)
{
try
{
return SqlHelper.ExecuteNonQuery(DBConnection(), CommandType.StoredProcedure, storedProcedure);
}
catch (SqlException sq)
{
throw sq;
}
}
public int ExecuteNonQuerySQL(string sqlquery)
{
try
{
return SqlHelper.ExecuteNonQuery(DBConnection(), CommandType.Text, sqlquery);
}
catch (SqlException sq)
{
throw sq;
}
}
public int ExecuteNonQuerywithTrans(string storedProcedure)
{
SqlConnection conTrans = new SqlConnection(DBConnection());
SqlTransaction sqlTrans;
conTrans.Open();
int returnResult = 0;
using (sqlTrans = conTrans.BeginTransaction())
{
try
{
returnResult = SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, storedProcedure);
sqlTrans.Commit();
return returnResult;
}
catch (Exception sq)
{
sqlTrans.Rollback();
throw sq;
}
finally
{
conTrans.Close();
}
}
}
public int ExecuteNonQuerywithTransfromFrontEnd(SqlTransaction sqlTrans, string storedProcedure, SqlParameter[] param)
{
try
{
int returnResult = SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, storedProcedure, param);
return returnResult;
}
catch (SqlException sq)
{
sqlTrans.Rollback();
throw sq;
}
}
public DataSet ExecuteDataset(string storedProcedure, SqlParameter[] param)
{
try
{
return SqlHelper.ExecuteDataset(DBConnection(), CommandType.StoredProcedure, storedProcedure, param);
}
catch (SqlException sq)
{
throw sq;
}
}
public DataSet ExecuteDatasetSQL(string storedProcedure)
{
try
{
return SqlHelper.ExecuteDataset(DBConnection(), CommandType.Text, storedProcedure);
}
catch (SqlException sq)
{
throw sq;
}
}
public DataSet ExecuteDataset(string storedProcedure)
{
try
{
return SqlHelper.ExecuteDataset(DBConnection(), CommandType.StoredProcedure, storedProcedure);
}
catch (SqlException sq)
{
throw sq;
}
}
public object ExecuteScalar(string storedProcedure, SqlParameter[] param)
{
try
{
return SqlHelper.ExecuteScalar(DBConnection(), CommandType.StoredProcedure, storedProcedure, param);
}
catch (SqlException sq)
{
throw sq;
}
}
public object ExecuteScalar(SqlTransaction sqlTrans, string storedProcedure, SqlParameter[] param)
{
try
{
return SqlHelper.ExecuteScalar(sqlTrans, CommandType.StoredProcedure, storedProcedure, param);
}
catch (SqlException sq)
{
throw sq;
}
}
public SqlDataReader ExecuteReader(string storedProcedure, SqlParameter[] param)
{
SqlDataReader reader = null;
try
{
reader = SqlHelper.ExecuteReader(DBConnection(), CommandType.StoredProcedure, storedProcedure, param);
return reader;
}
catch (SqlException sq)
{
throw sq;
}
}
public SqlDataReader ExecuteReader(string storedProcedure)
{
SqlDataReader reader = null;
try
{
reader = SqlHelper.ExecuteReader(DBConnection(), CommandType.StoredProcedure, storedProcedure);
return reader;
}
catch (SqlException sq)
{
throw sq;
}
}
public SqlDataReader ExecuteReaderSQL(string sqlquery)
{
SqlDataReader reader = null;
try
{
reader = SqlHelper.ExecuteReader(DBConnection(), CommandType.Text, sqlquery);
return reader;
}
catch (SqlException sq)
{
throw sq;
}
}
public int ExecuteNonQuerywithMultipleTrans(SqlTransaction sqlTrans, string storedProcedure)
{
int returnResult = 0;
try
{
returnResult = SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, storedProcedure);
return returnResult;
}
catch (Exception sq)
{
throw sq;
}
}
public int ExecuteNonQuerywithMultipleTrans(SqlTransaction sqlTrans, string storedProcedure, SqlParameter[] param)
{
int returnResult = 0;
try
{
returnResult = SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, storedProcedure, param);
return returnResult;
}
catch (Exception sq)
{
throw sq;
}
}
}
}
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace TurnkeySolutions.App_Code.BLL
{
public class clsUsers
{
public clsUsers()
{
//default consutructor
}
DBBridge objDBBridge = new DBBridge();
private string _eMail = String.Empty;
private string _Password = String.Empty;
private string _FirstName = String.Empty;
private string _LastName = String.Empty;
private string _CompanyName = String.Empty;
private DataSet _dsLogin = new DataSet();
const string _spName = "sp_tblUsers";
public string eMail
{
get
{
return this._eMail;
}
set
{
this._eMail = value;
}
}
public string Password
{
get
{
return this._Password;
}
set
{
this._Password = value;
}
}
public string FirstName
{
get
{
return this._FirstName;
}
set
{
this._FirstName = value;
}
}
public string LastName
{
get
{
return this._LastName;
}
set
{
this._LastName = value;
}
}
public string CompanyName
{
get
{
return this._CompanyName;
}
set
{
this._CompanyName = value;
}
}
public DataSet dsLogin
{
get
{
return this._dsLogin;
}
set
{
this._dsLogin = value;
}
}
public int Insert()
{
SqlParameter[] param = new SqlParameter[6];
param[0] = new SqlParameter("@Mode", "Insert");
param[1] = new SqlParameter("@eMail", _eMail);
param[2] = new SqlParameter("Password", _Password);
param[3] = new SqlParameter("@FirstName", _FirstName);
param[4] = new SqlParameter("@LastName", _LastName);
param[5] = new SqlParameter("@CompanyName", _CompanyName);
return objDBBridge.ExecuteNonQuery(_spName, param);
}
}
}
Please let me what is the error. I will thankful for that person.