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


C# SqlDatabase.GetStoredProcCommand方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: GetCustomer

        public override CustomerList GetCustomer(string vipCode)
        {
            SqlDatabase database = new SqlDatabase(ConnectionString);
            DbCommand command = database.GetStoredProcCommand("rmSP_WSPOS_GetCustomer");
            command.CommandTimeout = 300;
            database.AddInParameter(command, "@VipCode", DbType.String, vipCode);

            List<Customer> customers = new List<Customer>();
            using (IDataReader reader = database.ExecuteReader(command))
            {
                while (reader.Read())
                {
                    Customer customer = new Customer();
                    customer.CustomerId = Convert.ToInt32(reader["VIPCode_id"]);
                    customer.CustomerCode = reader["VipCode"] as string;
                    customer.FirstName = reader["VIPGName"] as string;
                    customer.LastName = reader["VIPName"] as string;
                    customer.Telephone = reader["VIPTel"] as string;
                    if (reader["VIPBDay"] != DBNull.Value)
                        customer.BirthDate = Convert.ToDateTime(reader["VIPBDay"]);

                    customers.Add(customer);
                }
            }

            CustomerList customerList = new CustomerList();
            customerList.Customers = customers;
            customerList.TotalCount = customers.Count;
            return customerList;
        }
开发者ID:GaryDev,项目名称:webservice-net,代码行数:30,代码来源:DataProviderMSSQL.cs

示例5: CurrectWeek

 public static int CurrectWeek()
 {
     SqlDatabase db = new SqlDatabase( connString );
     DbCommand command = db.GetStoredProcCommand( "getWeekNr" );
     command.CommandType = CommandType.StoredProcedure;
     //the +1 below is to correct for an apparent off-by-one error in the stored procedure
     return Convert.ToInt32( db.ExecuteScalar( command ) ) + 1;
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:8,代码来源:Utility.cs

示例6: CurrectWeekStartDate

        public static DateTime CurrectWeekStartDate( int currentWeek )
        {
            SqlDatabase db = new SqlDatabase( connString );
            DbCommand command = db.GetStoredProcCommand( "smWkNmStr" );
            command.CommandType = CommandType.StoredProcedure;
            db.AddInParameter( command, "@week_no", DbType.Int32, currentWeek );

            return Convert.ToDateTime( db.ExecuteScalar( command ) );
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:9,代码来源:Utility.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: Deparments

        public static IDataReader Deparments(int clientId)
        {
            SqlDatabase db = new SqlDatabase( connString );
            DbCommand command = db.GetStoredProcCommand( "ALOC__DepartmentSelectList" );
            db.AddInParameter( command, "@ClientId", DbType.Int32, clientId );
            command.CommandType = CommandType.StoredProcedure;

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

示例9: 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

示例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: SelectUser

 private static bool SelectUser(ref User user)
 {
     try
     {
         SqlDatabase db = new SqlDatabase(Properties.Settings.Default.connString);
         using (DbCommand cmd = db.GetStoredProcCommand("SelectUser"))
         {
             db.AddInParameter(cmd, "authcode", DbType.String, user.AuthCode);
             using (IDataReader dr = db.ExecuteReader(cmd))
             {
                 bool first = true;
                 while (dr.Read())
                 {
                     if (first)
                     {
                         user.Age = dr["age"] as string;
                         user.AuthCode = dr["authcode"] as string;
                         user.Gender = dr["gender"] as string;
                         first = false;
                     }
                     int? tid = dr["testid"] as int?;
                     if (tid != null)
                     {
                         Test t = null;
                         if (user.Tests.ContainsKey(tid.Value))
                             t = user.Tests[tid.Value];
                         else
                         {
                             t = new Test()
                             {
                                 ID = tid.Value,
                                 TimeEst = (int)dr["timeest"],
                                 MaxArraySize = (int)dr["maxarraysize"],
                                 DelayPeriod = (int)dr["delayperiod"]
                             };
                             user.Tests.Add(tid.Value, t);
                         }
                         t.ImageArrays.Add(new ImageArray()
                         {
                             Index = (int)dr["index"],
                             ImagesDisplayed = (int)dr["imagesdisplayed"],
                             UserInput = (int)dr["userinput"],
                             ImageFile = (string)dr["imagefile"]
                         });
                     }
                 }
             }
             return true;
         }
     }
     catch
     {
         return false;
     }
 }
开发者ID:jp9506,项目名称:Subitize-Test,代码行数:55,代码来源:Database.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: 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

示例14: 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

示例15: DeleteInactiveProfiles

        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption,
            DateTime userInactiveSinceDate)
        {
            SqlDatabase sqlDatabase = new SqlDatabase(_connectionString);
            DbCommand dbCommand = sqlDatabase.GetStoredProcCommand("adm.NlayerSP_EliminarPerfilesInactivos");

            sqlDatabase.AddInParameter(dbCommand, "Aplicacion", DbType.String, _applicationName);
            sqlDatabase.AddInParameter(dbCommand, "UltimaActividad", DbType.DateTime, userInactiveSinceDate);

            int deleteCount = (int) sqlDatabase.ExecuteScalar(dbCommand);

            return deleteCount;
        }
开发者ID:JeyssonRamirez,项目名称:NLayer,代码行数:13,代码来源:NlayerProfileProvider.cs


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