SqlCommand comm = new SqlCommand("INSERT INTO APPLICANTDETAILS(Username,Password,Firstname,Lastname,OtherNames,dateofbirth) VALUES(@Username,@Password,@Firstname,@LastName,@OtherNames,@dateOfbirth)", conn2);
comm.Parameters.Add("@Username", SqlDbType.VarChar, 100).Value = app.Username;
comm.Parameters.Add("@Password", SqlDbType.VarChar, 100).Value = app.Password;
comm.Parameters.Add("@Firstname", SqlDbType.VarChar, 100).Value = app.FirstName;
comm.Parameters.Add("@LastName", SqlDbType.VarChar, 100).Value = app.LastName;
comm.Parameters.Add("@OtherNames", SqlDbType.VarChar, 100).Value = app.OtherNames;
comm.Parameters.Add("@dateOfBirth",SqlDbType.VarChar,50).Value = app.DateOfBirth;
try
{
comm.Connection.Open();
comm.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally
{
comm.Connection.Close();
}