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.

Are those code classes in the same assembly? It seems the second class can't find a definition for the first class. Also this is a bad idea:

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;
            }
        }

2 reasons:
1) Why even bother catching an exception if you're just going to rethrow it?
2) The code you posted boxes the exception. You never want to do that because you hide import details. If you want to rethrow an exception you should just use the throw operator:

try
      {
        throw new InvalidOperationException();
      }
      catch
      {
        throw;
      }

I had copied the code to notepad and was just shutting everything down for the evening and noticed the problem:

namespace TurnkeySolutions.App_Code.[B]DAL[/B]
namespace TurnkeySolutions.App_Code[B].BLL[/B]

You need to add using TurnkeySolutions.App_Code.DAL; to your second class file. The class definition and implementation you posted are in two different namespaces.

Thanks for suggestion. How we check my classes or not belonging to same assembly and how would I add my classes to assembly.

I have fellow your instruct but receive the follow error.

Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'TurnkeySolution' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 11: using System.Xml.Linq;
Line 12: using System.Data.SqlClient;
Line 13: using TurnkeySolution.App_Code.DAL;
Line 14: 
Line 15: namespace TurnkeySolutions.App_Code.BLL


Source File: f:\Project\TurnkeySolutions\TurnkeySolutions\TurnkeySolutions\App_Code\BLL\clsUsers.cs    Line: 13

>>Thanks for suggestion. How we check my classes or not belonging to same assembly and how would I add my classes to assembly.

Are all of your code files in a single project or do you have a web application and other DLL projects in the solution? Can you upload the project? If you are using a DLL (I think you are) then you need to add a reference to the project or DLL in your web application. You will see a "References" node in the solution explorer. From there you can right click and add a reference. Simply copying a .NET DLL in to the execution directory will not suffice for web applications because of how the server compiles the assembly at execution time.

The all file belong to a single project in different folders. May you send your messenger id like yahoo, skype or msn. Then I would share my desktop you to would yourself check out his problem. And let me when you would be online. I am Farooq from Pakistan.

Unfortunately I don't use any messenger services. Send me a message here on the forums when you're online next (with your email) and we can get together. I have a GoToMeeting account we can use, or we can use your preferred meeting software.

<email snipped>. We can use Teamviewer to share desktop its free for Personal Use. Let

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.