D
Djramc
Guest
Im trying to develop a project with the possibility at the begin of a new File to choose between mdb file or MSSQL server as a data source. Now my question is what is the best solution to program this senario? I think to use two dataset using a MSSQL and second for mdb? any suggestions from proffesionals experiences this before. thanks by advance
my code for now is this ? do you think is that good idea to begin?
interface IDatabase
{
void Connect();
void Disconnect();
DataSet Fill_Customers();
int Update_Klanten(string Naamcontactpersoon, string Original_Klantnummer);
int Update_Klanten();
//more methods
}
public class AccessDatabase : IDatabase
{
DataSet2_mdbTableAdapters.KlantenTableAdapter kta = new DataSet2_mdbTableAdapters.KlantenTableAdapter();
DataSet2_mdb ds = new DataSet2_mdb();
public void Connect()
{
//implement here
}
public void Disconnect()
{
//implement here
}
public DataSet Fill_Customers()
{
kta.Fill(ds.Klanten);
return ds;
}
public int Update_Klanten(string Naamcontactpersoon, string Original_Klantnummer )
{
return kta.UpdateQuery(Naamcontactpersoon, Original_Klantnummer);
}
public int Update_Klanten()
{
bool someChanged = false;
object oTemp;
int NextPKKlanten;
if (this.ds.Klanten.GetChanges(DataRowState.Added) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Added).Rows)
{
oTemp = this.kta.GetNextPKKlanten();
NextPKKlanten = oTemp==null?1int)oTemp;
this.kta.InsertKlant(NextPKKlanten, row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]) == true ? (short)1 short) 0);
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Deleted) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Deleted).Rows)
{
this.kta.DeleteByPKKlanten((decimal)row["PKKlanten"]);
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Modified) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Modified).Rows)
{
this.kta.UpdateByPKKlanten(row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]) == true ? (short)1 : (short)0, (decimal) row["PKKlanten"]);
}
}
if(someChanged)
this.ds.AcceptChanges();
return 1;
}
//more
}
public class SQLDatabase : IDatabase
{
DataSet1TableAdapters.KlantenTableAdapter kta = new DataSet1TableAdapters.KlantenTableAdapter();
DataSet1 ds = new DataSet1();
public void Connect()
{
//implement here
}
public void Disconnect()
{
//implement here
}
public DataSet Fill_Customers()
{
kta.Fill(ds.Klanten);
return ds;
}
public int Update_Klanten(string Naamcontactpersoon, string Original_Klantnummer)
{
return kta.UpdateQuery(Naamcontactpersoon, Original_Klantnummer);
}
public int Update_Klanten()
{
bool someChanged = false;
object oTemp;
int NextPKKlanten;
if (this.ds.Klanten.GetChanges(DataRowState.Added) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Added).Rows)
{
oTemp = this.kta.GetNextPKKlanten();
NextPKKlanten = oTemp == null ? 1 : (int)oTemp;
this.kta.InsertKlant((long)NextPKKlanten, row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]));
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Deleted) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Deleted).Rows)
{
this.kta.DeleteByPKKlanten((long)row["PKKlanten"]);
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Modified) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Modified).Rows)
{
this.kta.UpdateByPKKlanten(row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]), (long)row["PKKlanten"]);
}
}
if(someChanged)
this.ds.AcceptChanges();
return 1;
}
//more
}
<form action="http://www.facebook.com/ajax/ufi/modify.php" class="live_10151360381707475_316526391751760 commentable_item autoexpand_mode" data-live="{"seq":10151360493247475}" id="u_jsonp_8_12" method="post" rel="async" style="margin:0px;padding:0px;color:#333333;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:11px;line-height:14px;"></form>
Student
Continue reading...
my code for now is this ? do you think is that good idea to begin?
interface IDatabase
{
void Connect();
void Disconnect();
DataSet Fill_Customers();
int Update_Klanten(string Naamcontactpersoon, string Original_Klantnummer);
int Update_Klanten();
//more methods
}
public class AccessDatabase : IDatabase
{
DataSet2_mdbTableAdapters.KlantenTableAdapter kta = new DataSet2_mdbTableAdapters.KlantenTableAdapter();
DataSet2_mdb ds = new DataSet2_mdb();
public void Connect()
{
//implement here
}
public void Disconnect()
{
//implement here
}
public DataSet Fill_Customers()
{
kta.Fill(ds.Klanten);
return ds;
}
public int Update_Klanten(string Naamcontactpersoon, string Original_Klantnummer )
{
return kta.UpdateQuery(Naamcontactpersoon, Original_Klantnummer);
}
public int Update_Klanten()
{
bool someChanged = false;
object oTemp;
int NextPKKlanten;
if (this.ds.Klanten.GetChanges(DataRowState.Added) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Added).Rows)
{
oTemp = this.kta.GetNextPKKlanten();
NextPKKlanten = oTemp==null?1int)oTemp;
this.kta.InsertKlant(NextPKKlanten, row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]) == true ? (short)1 short) 0);
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Deleted) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Deleted).Rows)
{
this.kta.DeleteByPKKlanten((decimal)row["PKKlanten"]);
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Modified) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Modified).Rows)
{
this.kta.UpdateByPKKlanten(row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]) == true ? (short)1 : (short)0, (decimal) row["PKKlanten"]);
}
}
if(someChanged)
this.ds.AcceptChanges();
return 1;
}
//more
}
public class SQLDatabase : IDatabase
{
DataSet1TableAdapters.KlantenTableAdapter kta = new DataSet1TableAdapters.KlantenTableAdapter();
DataSet1 ds = new DataSet1();
public void Connect()
{
//implement here
}
public void Disconnect()
{
//implement here
}
public DataSet Fill_Customers()
{
kta.Fill(ds.Klanten);
return ds;
}
public int Update_Klanten(string Naamcontactpersoon, string Original_Klantnummer)
{
return kta.UpdateQuery(Naamcontactpersoon, Original_Klantnummer);
}
public int Update_Klanten()
{
bool someChanged = false;
object oTemp;
int NextPKKlanten;
if (this.ds.Klanten.GetChanges(DataRowState.Added) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Added).Rows)
{
oTemp = this.kta.GetNextPKKlanten();
NextPKKlanten = oTemp == null ? 1 : (int)oTemp;
this.kta.InsertKlant((long)NextPKKlanten, row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]));
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Deleted) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Deleted).Rows)
{
this.kta.DeleteByPKKlanten((long)row["PKKlanten"]);
}
}
if (this.ds.Klanten.GetChanges(DataRowState.Modified) != null)
{
someChanged = true;
foreach (DataRow row in this.ds.Klanten.GetChanges(DataRowState.Modified).Rows)
{
this.kta.UpdateByPKKlanten(row["Klantnummer"].ToString(), row["Notities"].ToString(), row["Aanhef"].ToString(), row["Naambedrijf"].ToString(), row["Factuuradres"].ToString(), row["Naamcontactpersoon"].ToString(), row["Functie"].ToString(), row["Plaats"].ToString(), row["Telefoonnummer"].ToString(), row["Faxnummer"].ToString(), row["Mobielenummer"].ToString(), row["Postcode"].ToString()
, row["Land"].ToString(), row["Emailadres"].ToString(), row["Emailadres"].ToString(), row["Website"].ToString(), row["Btwnummer"].ToString(), row["Achternaam"].ToString(), Convert.ToBoolean(row["Geblokkeerd"]), (long)row["PKKlanten"]);
}
}
if(someChanged)
this.ds.AcceptChanges();
return 1;
}
//more
}
<form action="http://www.facebook.com/ajax/ufi/modify.php" class="live_10151360381707475_316526391751760 commentable_item autoexpand_mode" data-live="{"seq":10151360493247475}" id="u_jsonp_8_12" method="post" rel="async" style="margin:0px;padding:0px;color:#333333;font-family:lucida grande, tahoma, verdana, arial, sans-serif;font-size:11px;line-height:14px;"></form>
Student
Continue reading...