本文整理汇总了C#中Database.CreateCommand方法的典型用法代码示例。如果您正苦于以下问题:C# Database.CreateCommand方法的具体用法?C# Database.CreateCommand怎么用?C# Database.CreateCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database.CreateCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetByNummer
//Haal de gegevens op aan de hand van het lijnnummer en geeft een instantie van die lijn terug.
public Lijn GetByNummer(int nummer)
{
Lijn lijn = null;
Database db = new Database();
try
{
db.CreateCommand("SELECT * FROM lijn WHERE nummer = :nummer");
db.AddParameter("nummer", nummer);
while (db.Read())
{
lijn = new Lijn(db.GetValueByColumn<int>("id"), db.GetValueByColumn<int>("nummer"));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Close();
}
return lijn;
}
示例2: GetById
//Haal de gegevens op aan de hand van het ID en geeft van het spoor alle gegevens terug.
public static Spoor GetById(int id)
{
Spoor spoor = null;
Database db = new Database();
try
{
db.CreateCommand("SELECT * FROM spoor WHERE id = :id");
db.AddParameter("id", id);
db.Open();
db.Execute();
OracleDataReader dr = db.DataReader;
if (dr.HasRows)
{
dr.Read();
spoor = new Spoor(dr.GetValueByColumn<int>("id"), dr.GetValueByColumn<int>("nummer"),dr.GetValueByColumn<int>("lijnnummer1"), dr.GetValueByColumn<int>("lijnnummer2"));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Close();
}
return spoor;
}
示例3: GetById
//haal een remise op aan de hand van een ID
public Remise GetById(int id)
{
Remise remise = null;
Database db = new Database();
try
{
db.CreateCommand("SELECT * FROM remise WHERE id = :id");
db.AddParameter("id", id);
while (db.Read())
{
remise = new Remise(db.GetValueByColumn<int>("id"), db.GetValueByColumn<int>("nummer"));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Close();
}
return remise;
}
示例4: GetAll
//haal alle loggegevens op en returned een list hiervan
public static List<Log> GetAll()
{
List<Log> logs = new List<Log>();
Database db = new Database();
try
{
db.CreateCommand("SELECT * FROM tram_log");
while (db.Read())
{
logs.Add(new Log(db.GetValueByColumn<int>("id"), db.GetValueByColumn<int>("tram_id"),db.GetValueByColumn<int>("segment_id"),db.GetValueByColumn<DateTime>("created")));
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Close();
}
return logs;
}
示例5: Indexer
public Indexer()
{
database = new Database("b81ca2da-f0ca-4968-b9ef-a147009a4ef4.mysql.sequelizer.com",
"dbb81ca2daf0ca4968b9efa147009a4ef4", "lizeabvjtqokfima", "qauWLTF4Db7umBPvvyy5LPYAzjLvtFMJKNKnbahQUaN7eEks6ndW4FvHi3vAhkH6");
command = database.CreateCommand();
command.CommandTimeout = 0;
}
示例6: DELETE
public void DELETE(RMS.COMMON.MASTER.RMS_MARKETING obj)
{
try
{
using (Database db = new Database())
{
DataTable dt = new DataTable();
db.Commands.Add(db.CreateCommand(QUERY_DELETE));
db.Commands[0].Parameters.Add(new Parameter("@KODE", MySqlDbType.VarChar, obj.KODE));
dt = db.Commands[0].ExecuteDataTable();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例7: SELECTJENISBAYAR
public DataTable SELECTJENISBAYAR()
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_JENISBAYAR));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例8: SELECTAREA
public DataTable SELECTAREA()
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand("SELECT * FROM area"));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例9: DELETE
public void DELETE(RMS.COMMON.MASTER.RMS_PENERIMA obj)
{
try
{
using (Database db = new Database())
{
DataTable dt = new DataTable();
db.Commands.Add(db.CreateCommand(QUERY_DELETE));
db.Commands[0].Parameters.Add(new Parameter("@IDPENERIMA", MySqlDbType.Int32, obj.ID));
dt = db.Commands[0].ExecuteDataTable();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例10: CARI_BYNAMA
public DataTable CARI_BYNAMA(RMS.COMMON.DELIVERYORDER.RMS_PEMBAYARAN obj)
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_CARI_BYNAME));
//db.Commands[0].Parameters.Add(new Parameter("@NAMASALES", MySqlDbType.VarChar, obj.NAMA));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例11: CARI_BYKODE
public DataTable CARI_BYKODE(RMS.COMMON.MASTER.RMS_TENTANGPERUSAHAAN obj)
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_CARI_BYKODE));
db.Commands[0].Parameters.Add(new Parameter("@KODE", MySqlDbType.VarChar, obj.KODE));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例12: CARI_BYKODE
public DataTable CARI_BYKODE(RMS.COMMON.DELIVERYORDER.RMS_TAGIHAN obj)
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_CARI_BYKODE));
db.Commands[0].Parameters.Add(new Parameter("@NOINVOICE", MySqlDbType.VarChar, obj.NOINV));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例13: CARI_BYID
public DataTable CARI_BYID(RMS.COMMON.EXPRESS.RMS_SPJ obj)
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_CARI_BYID));
db.Commands[0].Parameters.Add(new Parameter("@ID", MySqlDbType.Int32, obj.ID));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例14: CARI_BYNAMA
public DataTable CARI_BYNAMA(RMS.COMMON.MASTER.RMS_USER obj)
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_CARI_BYNAME));
db.Commands[0].Parameters.Add(new Parameter("@USERNAME", MySqlDbType.VarChar, obj.username));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例15: CARI_BYKODE
public DataTable CARI_BYKODE(RMS.COMMON.EXPRESS.RMS_TRANSAKSI obj)
{
DataTable dt = new DataTable();
try
{
using (Database db = new Database())
{
db.Commands.Add(db.CreateCommand(QUERY_CARI_BYKODE));
// db.Commands[0].Parameters.Add(new Parameter("@NOCONNOTE", MySqlDbType.VarChar, obj.NOCONNOTE));
dt = db.Commands[0].ExecuteDataTable();
}
return dt;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}