本文整理汇总了C#中Database.GetSqlStringCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Database.GetSqlStringCommand方法的具体用法?C# Database.GetSqlStringCommand怎么用?C# Database.GetSqlStringCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database.GetSqlStringCommand方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateStoredProcedures
public static void CreateStoredProcedures(Database db)
{
string sql = "create procedure RegionSelect as " +
"select * from Region Order by RegionId";
DbCommand command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "create procedure RegionInsert (@RegionID int, @RegionDescription varchar(100) ) as " +
"insert into Region values(@RegionID, @RegionDescription)";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "create procedure RegionUpdate (@RegionID int, @RegionDescription varchar(100) ) as " +
"update Region set RegionDescription = @RegionDescription where RegionID = @RegionID";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "create procedure RegionDelete (@RegionID int) as " +
"delete from Region where RegionID = @RegionID";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
}
示例2: CreateStoredProcedures
public static void CreateStoredProcedures(Database db)
{
DbCommand command;
string sql;
sql = "create procedure RegionSelect (cur_OUT OUT PKGENTLIB_ARCHITECTURE.CURENTLIB_ARCHITECTURE) as " +
"BEGIN OPEN cur_OUT FOR select * from Region Order By RegionId; END;";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "create procedure RegionInsert (vRegionID IN Region.RegionID%TYPE, vRegionDescription IN Region.RegionDescription%TYPE) as " +
"BEGIN insert into Region values(vRegionID, vRegionDescription); END;";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "create procedure RegionUpdate (vRegionID IN Region.RegionID%TYPE, vRegionDescription IN Region.RegionDescription%TYPE) as " +
"BEGIN update Region set RegionDescription = vRegionDescription where RegionID = vRegionID; END;";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "create procedure RegionDelete (vRegionID IN Region.RegionID%TYPE) as " +
"BEGIN delete from Region where RegionID = vRegionID; END;";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
}
示例3: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
DbCommand countCommand = db.GetSqlStringCommand(countQuery);
baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
}
示例4: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(OracleTestConfigurationSource.CreateConfigurationSource());
db = factory.Create("OracleTest");
DbCommand insertCommand = db.GetSqlStringCommand(insertString);
DbCommand queryCommand = db.GetSqlStringCommand(queryString);
baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
}
示例5: TestInitialize
public void TestInitialize()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
DbCommand insertCommand = db.GetSqlStringCommand(insertString);
DbCommand queryCommand = db.GetSqlStringCommand(queryString);
baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
}
示例6: 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);
}
示例7: CreateDataAdapterCommands
public static void CreateDataAdapterCommands(Database db, ref DbCommand insertCommand, ref DbCommand updateCommand, ref DbCommand deleteCommand)
{
insertCommand = db.GetSqlStringCommand("INSERT INTO Region VALUES(@RegionID, @RegionDescription)");
updateCommand = db.GetSqlStringCommand("UPDATE region SET [email protected] WHERE [email protected]");
deleteCommand = db.GetSqlStringCommand("DELETE FROM Region WHERE [email protected]");
db.AddInParameter(insertCommand, "@RegionID", DbType.Int32, "RegionID", DataRowVersion.Default);
db.AddInParameter(insertCommand, "@RegionDescription", DbType.String, "RegionDescription", DataRowVersion.Default);
db.AddInParameter(updateCommand, "@RegionID", DbType.Int32, "RegionID", DataRowVersion.Default);
db.AddInParameter(updateCommand, "@RegionDescription", DbType.String, "RegionDescription", DataRowVersion.Default);
db.AddInParameter(deleteCommand, "@RegionID", DbType.Int32, "RegionID", DataRowVersion.Default);
}
示例8: DeleteStoredProcedures
public static void DeleteStoredProcedures(Database db)
{
DbCommand command;
string sql = "drop procedure RegionSelect";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "drop procedure RegionInsert";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "drop procedure RegionDelete";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
sql = "drop procedure RegionUpdate";
command = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(command);
}
示例9: SetUp
public void SetUp()
{
DatabaseProviderFactory factory = new DatabaseProviderFactory(TestConfigurationSource.CreateConfigurationSource());
db = factory.CreateDefault();
DbCommand command = db.GetSqlStringCommand("Select count(*) from region");
baseFixture = new ExecuteScalarFixture(db, command);
}
示例10: 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);
}
示例11: AddTestData
public static void AddTestData(Database db)
{
string sql =
"insert into Region values (99, 'Midwest');" +
"insert into Region values (100, 'Central Europe');" +
"insert into Region values (101, 'Middle East');" +
"insert into Region values (102, 'Australia')";
DbCommand testDataInsertion = db.GetSqlStringCommand(sql);
db.ExecuteNonQuery(testDataInsertion);
}
示例12: DataAccessTestsFixture
public DataAccessTestsFixture(Database db)
{
this.db = db;
dataSet = new DataSet();
command = db.GetSqlStringCommand(sqlQuery);
}
示例13: InsertSystemLog
private void InsertSystemLog(LogEntity entity, Database database)
{
DbCommand command = database.GetSqlStringCommand(string.Format(INSERT_SYSTEM_LOG_SQL, logTableName));
database.AddInParameter(command, "GUID", DbType.Guid, entity.ExtendedProperties.ContainsKey("Guid") ? entity.ExtendedProperties["Guid"] : Guid.NewGuid());
database.AddInParameter(command, "LogDate", DbType.DateTime, entity.ExtendedProperties.ContainsKey("LogDate") ? entity.ExtendedProperties["LogDate"] : DateTime.Now);
database.AddInParameter(command, "LogType", DbType.Int32, entity.ExtendedProperties["LogType"]);
database.AddInParameter(command, "LogUserLoginID", DbType.String, entity.ExtendedProperties["LogUserLoginID"]);
database.AddInParameter(command, "LogUserIP", DbType.String, entity.ExtendedProperties["LogUserIP"]);
database.AddInParameter(command, "LogSummary", DbType.String, GetLogSummary(entity));
database.AddInParameter(command, "LogDescription", DbType.String, GetLogDescription(entity));
database.AddInParameter(command, "OperationEntityCharacter", DbType.String, entity.ExtendedProperties.ContainsKey("OperationEntityCharacter") ? entity.ExtendedProperties["OperationEntityCharacter"] : DBNull.Value);
database.AddInParameter(command, "OperationEntityGuid", DbType.Guid, entity.ExtendedProperties.ContainsKey("OperationEntityGuid") ? new Guid(entity.ExtendedProperties["OperationEntityGuid"].ToString()) : Guid.Empty);
database.AddInParameter(command, "OperationEntityOriginalValue", DbType.String, entity.ExtendedProperties.ContainsKey("OperationEntityOriginalValue") ? entity.ExtendedProperties["OperationEntityOriginalValue"] : DBNull.Value);
database.AddInParameter(command, "OperationEntityCurrentValue", DbType.String, entity.ExtendedProperties.ContainsKey("OperationEntityCurrentValue") ? entity.ExtendedProperties["OperationEntityCurrentValue"] : DBNull.Value);
database.AddInParameter(command, "OperationEntityName", DbType.String, entity.ExtendedProperties.ContainsKey("OperationEntityName") ? entity.ExtendedProperties["OperationEntityName"] : DBNull.Value);
database.AddInParameter(command, "Level", DbType.Int32, entity.ExtendedProperties["Level"]);
database.ExecuteNonQuery(command);
}