[Quantproject-developers] QuantProject/b2_DataAccess OleDbSingleTableAdapter.cs,1.2,1.3
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:39:00
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21114/b2_DataAccess Modified Files: OleDbSingleTableAdapter.cs Log Message: The constructor has been overloaded and the SetAdapter method has been added. Index: OleDbSingleTableAdapter.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/OleDbSingleTableAdapter.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OleDbSingleTableAdapter.cs 11 May 2004 21:59:10 -0000 1.2 --- OleDbSingleTableAdapter.cs 26 May 2004 15:38:50 -0000 1.3 *************** *** 1,2 **** --- 1,24 ---- + /* + QuantProject - Quantitative Finance Library + + OleDbSingleTableAdapter.cs + Copyright (C) 2003 + Glauco Siliprandi + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + using System; using System.Data; *************** *** 28,38 **** get { return this.dataTable; } } ! ! public OleDbSingleTableAdapter( string selectStatement ) { try { - // string selectStatement = - // "select * from " + tableName + " where 1=2"; this.oleDbDataAdapter = new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); --- 50,58 ---- get { return this.dataTable; } } ! ! private void setAdapter( string selectStatement ) { try { this.oleDbDataAdapter = new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); *************** *** 41,45 **** this.oleDbDataAdapter.UpdateCommand = oleDbCommandBuilder.GetUpdateCommand(); this.oleDbDataAdapter.DeleteCommand = oleDbCommandBuilder.GetDeleteCommand(); - this.dataTable = new DataTable(); this.oleDbDataAdapter.Fill( this.dataTable ); } --- 61,64 ---- *************** *** 50,81 **** } } public OleDbSingleTableAdapter(string selectStatement, DataTable table ) { ! try ! { ! ! // string selectStatement = ! // "select * from " + tableName + " where 1=2"; ! this.oleDbDataAdapter = ! new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); ! OleDbCommandBuilder oleDbCommandBuilder = new OleDbCommandBuilder( oleDbDataAdapter ); ! this.oleDbDataAdapter.InsertCommand = oleDbCommandBuilder.GetInsertCommand(); ! this.oleDbDataAdapter.UpdateCommand = oleDbCommandBuilder.GetUpdateCommand(); ! this.oleDbDataAdapter.DeleteCommand = oleDbCommandBuilder.GetDeleteCommand(); ! this.dataTable = table; ! this.oleDbDataAdapter.Fill( this.dataTable ); ! } ! catch ( Exception ex ) ! { ! string exceptionMessage = ex.Message + "\n" + ex.StackTrace; ! Console.WriteLine( exceptionMessage ); ! } } ! // public void SetAdapterAndDataTable( string tableName ) ! // { ! // } } } --- 69,95 ---- } } + + public OleDbSingleTableAdapter( string selectStatement ) + { + this.dataTable = new DataTable(); + setAdapter( selectStatement ); + } public OleDbSingleTableAdapter(string selectStatement, DataTable table ) { ! this.dataTable = table; ! setAdapter( selectStatement ); } + public OleDbSingleTableAdapter() + { + } ! public void SetAdapter( string tableName ) ! { ! string selectStatement = ! "select * from " + tableName + " where 1=2"; ! setAdapter( selectStatement ); ! } } } |