hi all, somebody replied my previous question ....Thanks for reply....
I want to insert a record in a table using windows forms(C#). i am trying to insert a record with a mobile no(10 digit) 9999999999. while inserting it showing error like Value was either too large or too small for an Int32.
my table fields are like that
Access DB Name = fm.mdb Table name = tbl_test
Field name Datatype ========== ========= I_id Autonumber I_Name Text I_Address Text I_Mobile Number I_City Text
Code =====
private void btn_save Click(object sender, EventArgs e) { try { con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppPath + "fm.mdb"); con.Open(); cmd = new OleDbCommand("Insert into tbl_test(I_name,I_address,I_Mobile,I_City) values('" + fac_name.Text + "','" + fac_address.Text + "'," + '"+ fac_city.Text + "'," + int.Parse(fac_mobile.Text) + ")", con);
cmd.ExecuteNonQuery(); MessageBox.Show("Registered sucessfully..."); } catch { } finally { con.Close(); } } can u tell me how to insert thanks in advance
|
| Author: MuniHemadriBabu.Jogi 31 Oct 2009 | Member Level: Gold | Rating:  Points: 2 |
Hi
Don't store mobile number as as int, Please use text datatype. because the phone number exceeds int max value in MS access
|