当前位置: 首页>>代码示例>>C#>>正文


C# SqlDatabase.AddInParameter方法代码示例

本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase.AddInParameter方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabase.AddInParameter方法的具体用法?C# SqlDatabase.AddInParameter怎么用?C# SqlDatabase.AddInParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase的用法示例。


在下文中一共展示了SqlDatabase.AddInParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addNewUser

        public int addNewUser(string firstname, string lastname, string companyname, string email, string password, string countryid, string stateid, string mobile, int type, string verify)
        {
            int status = 0;
            try
            {
                Guid guid = Guid.NewGuid();
                Database objDB = new SqlDatabase(connectionStr);
                DbCommand objAdd = new SqlCommand();
                objAdd.CommandType = CommandType.StoredProcedure;
                objAdd.CommandText = "InsertUser";
                objDB.AddInParameter(objAdd, "@FName", DbType.String, firstname);
                objDB.AddInParameter(objAdd, "@LName", DbType.String, lastname);
                objDB.AddInParameter(objAdd, "@Companyname", DbType.String, companyname);
                objDB.AddInParameter(objAdd, "@Email", DbType.String, email);
                objDB.AddInParameter(objAdd, "@Password", DbType.String, password);
                objDB.AddInParameter(objAdd, "@Countryid", DbType.Int32, countryid);
                objDB.AddInParameter(objAdd, "@Stateid", DbType.Int32, stateid);
                objDB.AddInParameter(objAdd, "@Mobile", DbType.String, mobile);
                objDB.AddInParameter(objAdd, "@Type", DbType.Int32, type);
                objDB.AddInParameter(objAdd, "@Verify", DbType.String, verify);
                objDB.AddOutParameter(objAdd, "@Stat", DbType.Int16, 16);
                objDB.ExecuteNonQuery(objAdd);
                status = Convert.ToInt16(objDB.GetParameterValue(objAdd, "@Stat"));

                return status;
            }
            catch (Exception ex)
            {
                objErr.GeneralExceptionHandling(ex, "Website - User Registration", "addNewUser", "GENERAL EXCEPTION");
                return status;
            }
        }
开发者ID:pratikmoda,项目名称:StockLotDirect,代码行数:32,代码来源:BL_Login.cs

示例2: addInquiry

        public int addInquiry(string name, string email, string subject, string message)
        {
            int status = 0;
            try
            {
                Database objDB = new SqlDatabase(connectionStr);
                DbCommand objAdd = new SqlCommand();
                objAdd.CommandType = CommandType.StoredProcedure;
                objAdd.CommandText = "InsertInquiry";
                objDB.AddInParameter(objAdd, "@Name", DbType.String, name);
                objDB.AddInParameter(objAdd, "@Email", DbType.String, email);
                objDB.AddInParameter(objAdd, "@Subject", DbType.String, subject);
                objDB.AddInParameter(objAdd, "@Message", DbType.String, message);
                objDB.AddOutParameter(objAdd, "@Stat", DbType.Int16, 16);
                objDB.ExecuteNonQuery(objAdd);
                status = Convert.ToInt16(objDB.GetParameterValue(objAdd, "@Stat"));

                return status;
            }
            catch (Exception ex)
            {
                objCommom.LogFile("Contact.aspx", "addInquiry", ex);
                return status;
            }
        }
开发者ID:pratikmoda,项目名称:GreyMediaHouse,代码行数:25,代码来源:BL_Contact.cs

示例3: GetImportedRecords

        //fetch record
        public static DataTable GetImportedRecords(int? top = 1000, bool direction = true, string name = "",
             bool? gender = null, int? year = null, long? rank = null)
        {
            Database objDB = new SqlDatabase(ConfigurationManager.ConnectionStrings["DBaseConnectionString"].ConnectionString);
            DataSet _ds = new DataSet();
            using (DbCommand objCMD = objDB.GetStoredProcCommand("PSP_Babies_Get"))
            {
                objDB.AddInParameter(objCMD, "@Top",
                                     DbType.Int32, top??1000000);
                objDB.AddInParameter(objCMD, "@SortingDirection",
                                     DbType.String, direction.ToIndicator());

                objDB.AddInParameter(objCMD, "@Name",
                                     DbType.String, name);
                objDB.AddInParameter(objCMD, "@Gender",
                                     DbType.String, gender.ToIndicator());
                objDB.AddInParameter(objCMD, "@Year",
                                     DbType.Int32, year);
                objDB.AddInParameter(objCMD, "@Rank",
                                     DbType.Int64, rank);

                try
                {
                    _ds = objDB.ExecuteDataSet(objCMD);
                    return _ds != null ? _ds.Tables[0] : new DataTable();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
开发者ID:AmithRajMP,项目名称:mini-project,代码行数:33,代码来源:BabiesDataAccess.cs

示例4: SaveBaby

        public static void SaveBaby(string babyName, long position, bool gender, int year, long rank)
        {
            Database objDB = new SqlDatabase(ConfigurationManager.ConnectionStrings["DBaseConnectionString"].ConnectionString);
            using (DbCommand objCMD = objDB.GetStoredProcCommand("PSP_Babies_Save"))
            {
                objDB.AddInParameter(objCMD, "@Name",
                                     DbType.String, babyName);
                objDB.AddInParameter(objCMD, "@Gender",
                                     DbType.String, gender.ToIndicator());
                objDB.AddInParameter(objCMD, "@Position",
                                    DbType.Int64, position);
                objDB.AddInParameter(objCMD, "@Rank",
                                     DbType.Int64, rank);
                objDB.AddInParameter(objCMD, "@Year",
                                    DbType.Int32, year);

                //objDB.AddOutParameter(objCMD, "@strMessage", DbType.String, 255);

                try
                {
                    objDB.ExecuteNonQuery(objCMD);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
开发者ID:AmithRajMP,项目名称:mini-project,代码行数:28,代码来源:BabiesDataAccess.cs

示例5: PublicarMensajeSql

        public void PublicarMensajeSql(string aplicacion, string error, Exception excepcion)
        {
            try
            {
                SqlDatabase baseDedatos = new SqlDatabase(ConfigurationManager.ConnectionStrings["AccesoDual"].ConnectionString);
                DbCommand comando = baseDedatos.GetStoredProcCommand("adm.NlayerSP_RegistrarErrorAplicativo");

                comando.CommandType = CommandType.StoredProcedure;

                string interna = null;

                if (excepcion.InnerException != null)
                {
                    interna = excepcion.InnerException.Message;
                }

                baseDedatos.AddInParameter(comando, "Aplicacion", SqlDbType.NVarChar, aplicacion);
                baseDedatos.AddInParameter(comando, "Error", SqlDbType.NVarChar, error);
                baseDedatos.AddInParameter(comando, "Excepcion", SqlDbType.NText, excepcion.Message);
                baseDedatos.AddInParameter(comando, "Interna", SqlDbType.NText, interna);

                baseDedatos.ExecuteNonQuery(comando);
            }
            catch {}
        }
开发者ID:JeyssonRamirez,项目名称:NLayer,代码行数:25,代码来源:ManejarDeLogs.cs

示例6: GetResources

        public static DataTable GetResources(int jobId, int deptId)
        {
            SqlDatabase db = new SqlDatabase(connString);
            string sql = @" SELECT	U.UserId, U.FirstName + ' ' + U.LastName AS FullName, 
		                            t.TitleName as Title
                            FROM	AllocableUsers U LEFT JOIN JobTitles AS t ON U.currentTitleID=t.TitleID
                            WHERE	U.Active=1 AND U.UserId NOT IN (
                                    SELECT UserId FROM Assignments WHERE [email protected]_id
                                    AND (EndDate IS NULL OR EndDate>DATEADD(s, 1, CURRENT_TIMESTAMP))) 
                                    AND [email protected]_id AND realPerson='Y'
		                            AND UserId NOT IN (
			                            SELECT	UserId
			                            FROM	timeEntry
			                            WHERE	[email protected]_id AND UserId=U.UserId AND (TimeSpan IS NULL OR TimeSpan > 0)
		                            )
                            ORDER BY FullName";

            DbCommand command = db.GetSqlStringCommand(sql);
            db.AddInParameter(command, "@job_id", DbType.Int32, jobId);
            db.AddInParameter(command, "@dept_id", DbType.Int32, deptId);
            DataTable t = new DataTable();
            t = db.ExecuteDataSet(command).Tables[0].Copy();
            t.TableName = "Resources";
            command.Dispose();
            return t;
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:26,代码来源:ManageAssignments.cs

示例7: JobsAssignedTo

 public static IDataReader JobsAssignedTo(int clientId, int userId)
 {
     SqlDatabase db = new SqlDatabase(connString);
     DbCommand command = db.GetStoredProcCommand("ALOC_JobsAssignedTo");
     command.CommandType = CommandType.StoredProcedure;
     db.AddInParameter(command, "@ClientId", DbType.Int32, clientId);
     db.AddInParameter(command, "@UserId", DbType.Int32, userId);
     return db.ExecuteReader(command);
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:9,代码来源:Job.cs

示例8: Assign

 public static void Assign(int jobId, int userId)
 {
     SqlDatabase db = new SqlDatabase(connString);
     DbCommand cmd = db.GetStoredProcCommand("ALOC_Assign");
     db.AddInParameter(cmd, "@job_id", DbType.Int32, jobId);
     db.AddInParameter(cmd, "@user_id", DbType.Int32, userId);
     db.ExecuteNonQuery(cmd);
     cmd.Dispose();
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:9,代码来源:ManageAssignments.cs

示例9: AddEmployeeToRole

        public static void AddEmployeeToRole(int employeeID, int roleID)
        {
            string sqlQuery = "INSERT INTO EMPLOYEEROLES(EmployeeID, RoleID) Values (@EmployeeID, @RoleID)";
            Database db = new SqlDatabase(DBHelper.GetConnectionString());
            DbCommand dbCommand = db.GetSqlStringCommand(sqlQuery);
            db.AddInParameter(dbCommand, "EmployeeID", DbType.Int32, employeeID);
            db.AddInParameter(dbCommand, "RoleID", DbType.Int32, roleID);

            db.ExecuteNonQuery(dbCommand);
        }
开发者ID:tsubik,项目名称:SFASystem,代码行数:10,代码来源:EmployeeDB.cs

示例10: Clients

        public static IDataReader  Clients( string type, int userId )
        {
            SqlDatabase db = new SqlDatabase( connString );
            DbCommand command = db.GetStoredProcCommand( "ALOC__ClientSelectList" );
            command.CommandType = CommandType.StoredProcedure;
            db.AddInParameter( command, "@Type", DbType.String, type );
            db.AddInParameter( command, "@UserId", DbType.Int32, userId );

            return db.ExecuteReader( command );
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:10,代码来源:Client.cs

示例11: CreateRole

        public override void CreateRole(string roleName)
        {
            SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
            DbCommand dbCommand = sqlDatabase.GetStoredProcCommand("adm.NlayerSP_RegistrarRol");

            sqlDatabase.AddInParameter(dbCommand, "Aplicacion", DbType.String, _applicationName);
            sqlDatabase.AddInParameter(dbCommand, "Nombre", DbType.String, roleName);
            sqlDatabase.AddInParameter(dbCommand, "Activo", DbType.Boolean, true);

            sqlDatabase.ExecuteNonQuery(dbCommand);
        }
开发者ID:JeyssonRamirez,项目名称:NLayer,代码行数:11,代码来源:NlayerRoleProvider.cs

示例12: IsUserInRole

        public override bool IsUserInRole(string username, string roleName)
        {
            SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
            DbCommand dbCommand = sqlDatabase.GetStoredProcCommand("adm.SCISP_EstaElUsuarioEnElRol");

            sqlDatabase.AddInParameter(dbCommand, "Aplicacion", DbType.String, _applicationName);
            sqlDatabase.AddInParameter(dbCommand, "Login", DbType.String, username);
            sqlDatabase.AddInParameter(dbCommand, "Rol", DbType.String, roleName);

            return (bool) sqlDatabase.ExecuteScalar(dbCommand);
        }
开发者ID:JeyssonRamirez,项目名称:Freelance,代码行数:11,代码来源:NalyerRoleProvider.cs

示例13: UpdateContact

        public static void UpdateContact(Contact contact)
        {
            string sqlQuery = "UPDATE Contact SET [email protected],[email protected],[email protected],[email protected] WHERE ContactID=" + contact.ContactID;

            Database db = new SqlDatabase(DBHelper.GetConnectionString());
            DbCommand dbCommand = db.GetSqlStringCommand(sqlQuery);
            db.AddInParameter(dbCommand, "FirstName", DbType.String, contact.FirstName);
            db.AddInParameter(dbCommand, "LastName", DbType.String, contact.LastName);
            db.AddInParameter(dbCommand, "Email", DbType.String, contact.Email);
            db.AddInParameter(dbCommand, "Phone", DbType.String, contact.Phone);
            db.ExecuteNonQuery(dbCommand);
        }
开发者ID:tsubik,项目名称:SFASystem,代码行数:12,代码来源:ContactDB.cs

示例14: UpdateTerritory

        public static void UpdateTerritory(Territory territory)
        {
            string sqlQuery = "UPDATE Territory SET [email protected], [email protected], [email protected] WHERE TerritoryID=" + territory.TerritoryID;

            Database db = new SqlDatabase(DBHelper.GetConnectionString());
            DbCommand dbCommand = db.GetSqlStringCommand(sqlQuery);
            db.AddInParameter(dbCommand, "ParentTerritoryID", DbType.Int32, territory.ParentTerritoryID);
            db.AddInParameter(dbCommand, "FullDescription", DbType.String, territory.FullDescription);
            db.AddInParameter(dbCommand, "Name", DbType.String, territory.Name);

            db.ExecuteNonQuery(dbCommand);
        }
开发者ID:tsubik,项目名称:SFASystem,代码行数:12,代码来源:TerritoryDB.cs

示例15: AllocatedJobs

 private static DataTable AllocatedJobs(int region, int startWeek)
 {
     SqlDatabase db = new SqlDatabase(connString);
     DbCommand command = db.GetStoredProcCommand("ALOC_RegionGridJobListSelect");
     command.CommandType = CommandType.StoredProcedure;
     db.AddInParameter(command, "@RegionId", DbType.Int32, region);
     db.AddInParameter(command, "@StartWeek", DbType.Int32, startWeek);
     DataTable dt = null;
     dt = db.ExecuteDataSet(command).Tables[0].Copy();
     dt.TableName = "Jobs";
     command.Dispose();
     return dt;
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:13,代码来源:RegionGrid.cs


注:本文中的Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase.AddInParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。