コード例 #1
0
 public int UpdateTable(DataSet dataSet)
 {
     DbCommand sQLStringCommand = db.GetSQLStringCommand("SELECT * FROM " + dataSet.Tables[0].TableName);
     sQLStringCommand.Connection = db.OpenConnection();
     FbDataAdapter adapter = new FbDataAdapter();
     FbCommandBuilder builder = new FbCommandBuilder(adapter);
     adapter.SelectCommand = (FbCommand)sQLStringCommand;
     adapter.DeleteCommand = builder.GetDeleteCommand();
     adapter.UpdateCommand = builder.GetUpdateCommand();
     adapter.RowUpdated += new FbRowUpdatedEventHandler(adapter_RowUpdated);
     return adapter.Update(dataSet.Tables[0]);
 }
コード例 #2
0
        public void CommandBuilderWithExpressionFieldTest()
        {
            adapter.SelectCommand.CommandText = "select	TEST.*,	0 AS VALOR from	TEST";

            FbCommandBuilder builder = new FbCommandBuilder(adapter);

            Console.WriteLine();
            Console.WriteLine("CommandBuilder -	GetUpdateCommand Method	Test");

            Console.WriteLine(builder.GetUpdateCommand().CommandText);

            builder.Dispose();
        }
コード例 #3
0
        public void TestWithClosedConnection()
        {
            Connection.Close();

            FbCommandBuilder builder = new FbCommandBuilder(adapter);

            Console.WriteLine();
            Console.WriteLine("CommandBuilder -	RefreshSchema Method Test -	Commands for original SQL statement: ");

            Console.WriteLine(builder.GetInsertCommand().CommandText);
            Console.WriteLine(builder.GetUpdateCommand().CommandText);
            Console.WriteLine(builder.GetDeleteCommand().CommandText);

            adapter.SelectCommand.CommandText = "select	* from TEST	where BIGINT_FIELD = ?";

            builder.RefreshSchema();

            Console.WriteLine();
            Console.WriteLine("CommandBuilder -	RefreshSchema Method Test -	Commands for new SQL statement:	");

            Console.WriteLine(builder.GetInsertCommand().CommandText);
            Console.WriteLine(builder.GetUpdateCommand().CommandText);
            Console.WriteLine(builder.GetDeleteCommand().CommandText);

            builder.Dispose();
        }
コード例 #4
0
        public void GetUpdateCommandTest()
        {
            FbCommandBuilder builder = new FbCommandBuilder(adapter);

            Console.WriteLine();
            Console.WriteLine("CommandBuilder -	GetUpdateCommand Method	Test");

            Console.WriteLine(builder.GetUpdateCommand().CommandText);

            builder.Dispose();
        }