Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot insert Phone Number into Database (MS Access File)
    primarykey
    data
    text
    <p>I'm creating a database app; with MS Access dataBase file. What happens is everything is inserted correctly, but not Phone Numbers. When entering a Phone Number the Application i am working throws me an exception.</p> <p>I've double checked my coding and my Database and can't figure out why this issue is caused. Here's the part of the code.</p> <pre><code> private void btn_Save_Click(object sender, EventArgs e) { { try { OleDbCommand DBcmd = new OleDbCommand(); DBcmd.CommandType = CommandType.Text; DBcmd.CommandText = "INSERT INTO tbl_ClientInfo (FirstName, LastName, Address, ZipCode, City, State, Country, Language, PhoneNr, MobileNr)" + "VALUES (@FirstName, @LastName, @Address, @ZipCode, @City, @State, @Country, @Language, @PhoneNr, @MobileNr)"; DBcmd.Parameters.AddWithValue("@FirstName", txt_FirstName.Text); DBcmd.Parameters.AddWithValue("@LastName", txt_LastName.Text); DBcmd.Parameters.AddWithValue("@Address", txt_Address.Text); DBcmd.Parameters.AddWithValue("@ZipCode", txt_ZipCode.Text); DBcmd.Parameters.AddWithValue("@City", txt_City.Text); DBcmd.Parameters.AddWithValue("@State", txt_State.Text); DBcmd.Parameters.AddWithValue("@Country", ComboBox_Countries.SelectedItem); DBcmd.Parameters.AddWithValue("@Language", comboBox_Languages.SelectedItem); DBcmd.Parameters.AddWithValue("@PhoneNr", txt_PhoneNr.Text); DBcmd.Parameters.AddWithValue("@MobileNr", txt_MobileNr.Text); DBcmd.Connection = DBconnection; DBconnection.Open(); DBcmd.ExecuteNonQuery(); DBconnection.Close(); catch (Exception ex) { System.IO.StreamWriter file = new System.IO.StreamWriter(@"d:\test.txt"); file.WriteLine(ex); file.Close(); } } } </code></pre> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload