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


C# Database.GetSqlStringCommand方法代码示例

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


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

示例1: CreateStoredProcedures

        public static void CreateStoredProcedures(Database db)
        {
            DbCommand command;
            string sql;

            try
            {
                DeleteStoredProcedures(db);
            }
            catch { }

            sql = "CREATE OR REPLACE PACKAGE PKGENTLIB AS " +
                "TYPE T_CURSOR IS REF CURSOR; " +
                "PROCEDURE RegionSelect (CUR_OUT OUT T_CURSOR); " +
                "END PKGENTLIB;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "CREATE OR REPLACE PACKAGE BODY PKGENTLIB AS " +
                "PROCEDURE RegionSelect(CUR_OUT OUT T_CURSOR) IS " +
                "V_CURSOR T_CURSOR; " +
                "BEGIN " +
                "OPEN V_CURSOR FOR " +
                "SELECT * FROM Region ORDER BY RegionID; " +
                "CUR_OUT := V_CURSOR; " +
                "END RegionSelect; " +
                "END PKGENTLIB;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "create procedure RegionInsert (pRegionID IN Region.RegionID%TYPE, pRegionDescription IN Region.RegionDescription%TYPE) as " +
                    "BEGIN " +
                    "   insert into Region values(pRegionID, pRegionDescription); " +
                    "END;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "create procedure RegionUpdate (pRegionID IN Region.RegionID%TYPE, pRegionDescription IN Region.RegionDescription%TYPE) as " +
                    "BEGIN " +
                    "   update Region set RegionDescription = pRegionDescription where RegionID = pRegionID; " +
                    "END;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "create procedure RegionDelete (pRegionID IN Region.RegionID%TYPE) as " +
                    "BEGIN " +
                    "   delete from Region where RegionID = pRegionID; " +
                    "END;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);
        }
开发者ID:VAllens,项目名称:EntLibContrib.Data.Oracle.ManagedDataAccess,代码行数:56,代码来源:OracleDataSetHelper.cs

示例2: SetUp

        public void SetUp()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
            DbCommand countCommand = db.GetSqlStringCommand(countQuery);

            baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
        }
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:11,代码来源:SqlCeExecuteNonQueryFixture.cs

示例3: SetUp

        public void SetUp()
        {
            EnvironmentHelper.AssertOracleClientIsInstalled();
            DatabaseProviderFactory factory = new DatabaseProviderFactory(OracleTestConfigurationSource.CreateConfigurationSource());
            db = factory.Create("OracleTest");

            DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
            DbCommand countCommand = db.GetSqlStringCommand(countQuery);

            baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
        }
开发者ID:VAllens,项目名称:EntLibContrib.Data.Oracle.ManagedDataAccess,代码行数:11,代码来源:OracleExecuteNonQueryFixture.cs

示例4: TestInitialize

        public void TestInitialize()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand insertCommand = db.GetSqlStringCommand(insertString);
            queryCommand = db.GetSqlStringCommand(queryString);

            baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
        }
开发者ID:HondaBey,项目名称:EnterpriseLibrary6,代码行数:11,代码来源:SqlCeExecuteReaderFixture.cs

示例5: GetAll

 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select KATILIMCI_ID,UZMANLIK_ALANI_ID from KATILIMCI_UZMANLIK_ARATABLO "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:8,代码来源:KatilimciUzmanlikAratabloDao.cs

示例6: GetAllReader

 public IDataReader GetAllReader(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,ACIKLAMA from SECENEK_TIP "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteReader(dbComm);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:8,代码来源:SecenekTipDao.cs

示例7: DeleteTrServicedetailsInfoById

        public bool DeleteTrServicedetailsInfoById(object param, Database db, DbTransaction transaction)
        {
            string sql = "DELETE FROM TR_ServiceDetails WHERE [email protected]";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            db.AddInParameter(dbCommand, "Id", DbType.String, param);

            db.ExecuteNonQuery(dbCommand, transaction);
            return true;
        }
开发者ID:cipher4uall,项目名称:hop-attendance,代码行数:9,代码来源:TrServicedetailsDAL.cs

示例8: CreateCommand

        protected virtual System.Data.Common.DbCommand CreateCommand(string commandText)
        {
            if (string.IsNullOrWhiteSpace(commandText))
                throw new ArgumentNullException();

            dbConnection = CreateDB();
            System.Data.Common.DbCommand cmd = dbConnection.GetSqlStringCommand(commandText);
            return cmd;
        }
开发者ID:chinadev,项目名称:com-tiger-task,代码行数:9,代码来源:DataHandler.cs

示例9: Delete

 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ORGANIZASYON where [email protected] ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     Organizasyon nesne = new Organizasyon();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:9,代码来源:OrganizasyonDao.cs

示例10: Delete

 public int Delete(int katilimciId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE KATILIMCI_ANKET_CEVAP_ARATABLO where [email protected] ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@katilimciId", DbType.Int32, katilimciId);
     KatilimciAnketCevapAratablo nesne = new KatilimciAnketCevapAratablo();
     nesne.KatilimciId = katilimciId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:9,代码来源:KatilimciAnketCevapAratabloDao.cs

示例11: Delete

 public int Delete(int anketId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ANKET_SORU_ARATABLO where [email protected] ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@anketId", DbType.Int32, anketId);
     AnketSoruAratablo nesne = new AnketSoruAratablo();
     nesne.AnketId = anketId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:9,代码来源:AnketSoruAratabloDao.cs

示例12: SetUp

        public void SetUp()
        {
            EnvironmentHelper.AssertOracleClientIsInstalled();
            DatabaseProviderFactory factory = new DatabaseProviderFactory(OracleTestConfigurationSource.CreateConfigurationSource());
            db = factory.Create("OracleTest");
            DbCommand command = db.GetSqlStringCommand("Select count(*) from region");

            baseFixture = new ExecuteScalarFixture(db, command);
        }
开发者ID:VAllens,项目名称:EntLibContrib.Data.Oracle.ManagedDataAccess,代码行数:9,代码来源:OracleExecuteScalarFixture.cs

示例13: Delete

 public int Delete(int secenekId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE SORU_SECENEK_ARATABLO where [email protected] ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@secenekId", DbType.Int32, secenekId);
     SoruSecenekAratablo nesne = new SoruSecenekAratablo();
     nesne.SecenekId = secenekId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:9,代码来源:SoruSecenekAratabloDao.cs

示例14: Delete

 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE UZMANLIK_ALANLARI where [email protected] ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     UzmanlikAlanlari nesne = new UzmanlikAlanlari();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:9,代码来源:UzmanlikAlanlariDao.cs

示例15: Delete

 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ANKET where [email protected] ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     Anket nesne = new Anket();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
开发者ID:bahattinz,项目名称:SeminerKayit-1,代码行数:9,代码来源:AnketDao.cs


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