私はテスト目的でNULLを許可するためにすべての列を持つデータベーステーブルを持っています。私のすべての列の間に、int、varcharまたはbitのデータ型があります。私は、フォームを送信しようとすると私は、次のエラーメッセージが表示されます。ここではlinq to sqlの挿入エラーに関するヘルプ
Value was either too large or too small for an Int32.
はコードです:
using (storeDataContext db = new storeDataContext())
{
db.Dealerssses.InsertOnSubmit(new Dealersss
{
AppFName = txtFName.Text,
AppLName = txtLName.Text,
AppTitle = ddlTitles.SelectedItem.Text,
AppPhone = Convert.ToInt32(txtPhone.Text),
AppEmail = txtEmail.Text,
AppAddress = txtAddress.Text,
AppCity = txtCity.Text,
AppState = txtState.Text,
AppZip = Convert.ToInt32(txtZip.Text),
BusName = txtBusName.Text,
BusCA = Convert.ToInt32(txtBusResale.Text),
BusContact = txtBusContact.Text,
BusDBA = txtDBA.Text,
BusEIN = Convert.ToInt32(txtBusEIN.Text),
BusEmail = txtBusEmail.Text,
BusFax = Convert.ToInt32(txtBusFax.Text),
BusMonth = ddlMonthStart.SelectedItem.Text,
BusNumEmployees = Convert.ToInt32(txtBusEmployees.Text),
BusPhone = Convert.ToInt32(txtBusPhone.Text),
BusYear = int.Parse(txtYearStart.Text),
Active = false
});
db.SubmitChanges();
};
あなたはこのエラーを読んでいますか? – SLaks
@slaksの場合、フォームに転記される値は1〜15桁であるため、int32では値が大きすぎることはできません。 –
あなたのコードは有効な郵便番号07055を駄目にするでしょう。**非数値データを整数列に格納しないでください!** – SLaks