bool Methods::InsertNewPatientDetails(CString m_FirstName, CString m_LastName, CString m_DateOfBirth, CString m_ContactNo) //method to insert new patient details in db
{
try
{
if (DBConnection()) //check if DB is connected
{
m_SqlStr.Format(_T("insert into PatientDetails(firstname,lastname,date_of_birth,contact_no,is_deleted) values ('%s','%s','%s','%s','0')"), (m_FirstName),(m_LastName), (m_DateOfBirth), (m_ContactNo)); //query to insert data to DB
m_CDatabase.ExecuteSQL(m_SqlStr); //executes DB query
m_CDatabase.Close(); //close db connection
return true;
}
else
{
return false;
}
}
catch (CDBException *e)
{
return false;
AfxMessageBox(L"Database Error: " + e->m_strError);
}
}
dimanche 24 septembre 2017
Suggestions for native testing the following piece of code
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire