So basically I am working with 2 layers, the first layer is called "BL" (stands for Business Logic) and the other layer is called "DAL".
I have a database which contains a users table (in one of its tables).
BL is accessing DAL through a reference (.dll) and DAL is accessing the Database (BL has no direct access to database).
I would like to receive user info on BL, send this to the DAL, which will insert it to the database.
My current methods:
BL:
public bool InsertUser(string userFName, string userLName, string userPass, DateTime userBirth, string userEmail, string userCountry)
{
if (UsersDAL.Insert(userFName, userLName, userPass, userBirth.ToString(), userEmail, userCountry))
{
return true;
}
return false;
}
DAL:
public static bool Insert(string userFName, string userLName, string userPass, string userBirth, string userEmail, string userCountry)
{
DateTime userBirthday = DateTime.Parse(userBirth);
try
{
OleDbHelper.fill("INSERT INTO UsersTable(userFName, userLName, userPass, userBirth, userEmail, userCountry, userActive) VALUES('" + userFName + "', '" + userLName + "', '" + userPass + "', " + userBirthday + ", '" + userEmail + "', '" + userCountry + "', true)", "UsersTable");
}
catch
{
return false;
}
return true;
}
The problem occurs with the Datetime thingy, so I can't find any solution for it.
Note: On the database, "userBirth" is a DateTime