1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace ConfigurationTool
{
class DAConfig
{
MySqlConnection Connection;
//Command
MySqlCommand myCmdComputer = new MySqlCommand();
MySqlCommand myCmdDiscInfo = new MySqlCommand();
//DataAdapters
public static MySqlDataAdapter myDAComputer = new MySqlDataAdapter();
public static MySqlDataAdapter myDADiscInfo = new MySqlDataAdapter();
public DAConfig()
{
if (myDAComputer.SelectCommand == null)
{
MySqlCommandBuilder myCB;
Connection = DataLayer.Connection;
//Computer
/*myCmdComputer.Connection = Connection;
myDAComputer.SelectCommand = new MySqlCommand("SELECT * FROM Computer", Connection);
myCB = new MySqlCommandBuilder(myDAComputer);
myDAComputer.InsertCommand = myCB.GetInsertCommand();
myDAComputer.UpdateCommand = myCB.GetUpdateCommand();
myDAComputer.DeleteCommand = myCB.GetDeleteCommand();*/
//Disques
myCmdDiscInfo.Connection = Connection;
myDADiscInfo.SelectCommand = new MySqlCommand("SELECT * FROM DiscInfo", Connection);
myCB = new MySqlCommandBuilder(myDADiscInfo);
myDADiscInfo.InsertCommand = myCB.GetInsertCommand();
myDADiscInfo.UpdateCommand = myCB.GetUpdateCommand();
myDADiscInfo.DeleteCommand = myCB.GetDeleteCommand();
}
}
[...] |
Partager