2 // Mono.Data.DataTools
\r
5 // Brian Ritchie (brianlritchie@hotmail.com)
\r
8 // Copyright (C) Brian Ritchie, 2002
\r
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 /// Summary description for ProviderTools.
\r
40 public class DataTools
\r
46 static public IDataParameter AddParameter(IDbCommand Cmd, string ParameterName, DbType DbType,
\r
47 ParameterDirection Direction)
\r
49 IDataParameter param=Cmd.CreateParameter();
\r
50 Cmd.Parameters.Add(param);
\r
51 param.ParameterName=ParameterName;
\r
52 param.Direction=Direction;
\r
53 param.DbType=DbType;
\r
57 static public IDataParameter AddParameter(IDbCommand Cmd, string ParameterName, DbType DbType)
\r
59 IDataParameter param=Cmd.CreateParameter();
\r
60 Cmd.Parameters.Add(param);
\r
61 param.ParameterName=ParameterName;
\r
62 param.DbType=DbType;
\r
66 static public DataSet FillDataSet(IDbConnection conn, string SelectCommand)
\r
68 DataSet ds=new DataSet();
\r
69 IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(conn, SelectCommand);
\r
70 if (conn.State!=ConnectionState.Open)
\r
76 static public DataSet FillDataSet(IDbCommand SelectCommand)
\r
78 DataSet ds=new DataSet();
\r
79 IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(SelectCommand);
\r
80 if (adapter.SelectCommand.Connection.State!=ConnectionState.Open)
\r
81 adapter.SelectCommand.Connection.Open();
\r
86 static public DataSet FillDataSet(string ConfigSetting, string SelectCommand)
\r
88 IDbConnection conn=ProviderFactory.CreateConnectionFromConfig(ConfigSetting);
\r
94 IDbDataAdapter adapter=ProviderFactory.CreateDataAdapter(conn, SelectCommand);
\r