asp.net で単純なアプリケーションを実行しています。このアプリケーションは、さまざまなページのテキスト ボックスから入力を受け取り、最後のページでアダプターを介して挿入メソッドを使用しています。テキスト ボックスに hjihi のようなダミー入力を使用すると、例外が発生しません。しかし、フィールドに適切な入力を使用すると、このページ全体が恐ろしいエラーになります。検索しましたが、適切な回答が得られませんでした。
Server Error in '/Job Portal10' Application.
String or binary data would be truncated.
The statement has been terminated.
説明:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated.
ステートメントは終了されました。
ソース エラー:
Line 6127: }
Line 6128: try {
Line 6129: int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery();
Line 6130: return returnValue;
Line 6131: }
Source File: c:\Users\Haris Riaz\AppData\Local\Temp\Temporary ASP.NET Files\job portal10\a1906c7c\e3e5272e\App_Code.6jqq8vva.1.cs Line: 6129
Stack Trace:
[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
DataSet1TableAdapters.Emp_UpdateTableAdapter.Insert(String Title, String First_Name, String Last_Name, String F_First_Name, String F_Last_Name, String Gender, String Nationality, String Maritial_Status, String DOB, String CNIC, String Domicile, String Dependents, String Qualification_10Years, String Board_10_Years_Edu, String Completion_10_years, String Percmarks_10_Years, String Division_10_Years, String Qualification_12_years, String Board_12_years_Edu, String Completion_12_years, String Percmarks_12_Years, String Division_12_years, String Qualification_16_years, String Board_16_years_Edu, String Completion_16_years, String Percmarks_16_Years, String Division_16_years, String Qualification_18_years, String Board_18_years_Edu, String Completion_18_years, String Percmarks_18_Years, String Division_18_years, String Qualification_21_years, String Board_21_years_Edu, String Completion_21_years, String Percmarks_21_Years, String Division_21_years, String exp_1_Organization, String Designation_1, String Duration_From_1_1, String Duration_From_1_2, String Address_1, String Contact_1, String Supervisor_1, String Jobreason_1, String StartingSalary_1, String EndingSalary_1, String exp_2_Organization, String Designation_2, String Duration_From_2_1, String Duration_From_2_2, String Address_2, String Contact_2, String Supervisor_2, String Jobreason_2, String StartingSalary_2, String EndingSalary_2, String exp_3_Organization, String Designation_3, String Duration_From_3_1, String Duration_From_3_2, String Address_3, String Contact_3, String Supervisor_3, String Jobreason_3, String StartingSalary_3, String EndingSalary_3, String Permanent_Address, String Current_Address, String Permanent_City, String Current_City, String Permanent_Country, String Phone_Number, String Mobile_Number, String Email_Address, String Fax, String Ref_Name_1, String Ref_Designation_1, String Ref_Org_1, String Ref_Email_1, String Ref_Add_1, String Ref_Mobile_1, String Ref_Name_2, String Ref_Designation_2, String Ref_Org_2, String Ref_Email_2, String Ref_Add_2, String Ref_Mobile_2, String Ref_Name_3, String Ref_Designation_3, String Ref_Org_3, String Ref_Email_3, String Ref_Add_3, String Ref_Mobile_3) in c:\Users\Haris Riaz\AppData\Local\Temp\Temporary ASP.NET Files\job portal10\a1906c7c\e3e5272e\App_Code.6jqq8vva.1.cs:6129
UpdateProfile.Button1_Click(Object sender, EventArgs e) in c:\Users\Haris Riaz\Desktop\apna kaam\Job Portal10\UpdateProfile_References.aspx.cs:58
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
これが私のボタンで使用した私のc#です
public partial class UpdateProfile : System.Web.UI.Page
{
DatabaseConnect DB = new DatabaseConnect();
DataSet1TableAdapters.Emp_UpdateTableAdapter td = new DataSet1TableAdapters.Emp_UpdateTableAdapter();
static public String ref_name_1;
static public String ref_designation_1;
static public String ref_org_1;
static public String ref_email_1;
static public String ref_add_1;
static public String ref_mobile_1;
static public String ref_name_2;
static public String ref_designation_2;
static public String ref_org_2;
static public String ref_email_2;
static public String ref_add_2;
static public String ref_mobile_2;
static public String ref_name_3;
static public String ref_designation_3;
static public String ref_org_3;
static public String ref_email_3;
static public String ref_add_3;
static public String ref_mobile_3;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ref_name_1 = TextBox10.Text;
ref_designation_1 = TextBox11.Text;
ref_org_1 = TextBox12.Text;
ref_email_1 = TextBox13.Text;
ref_add_1 = TextBox14.Text;
ref_mobile_1 = TextBox28.Text;
ref_name_2 = TextBox16.Text;
ref_designation_2 = TextBox17.Text;
ref_org_2 = TextBox18.Text;
ref_email_2 = TextBox19.Text;
ref_add_2 = TextBox20.Text;
ref_mobile_2 = TextBox29.Text;
ref_name_3 = TextBox22.Text;
ref_designation_3 = TextBox23.Text;
ref_org_3 = TextBox24.Text;
ref_email_3 = TextBox25.Text;
ref_add_3 = TextBox26.Text;
ref_mobile_3 = TextBox30.Text;
td.Insert(Session["Titl"].ToString(),
Session["First_Name"].ToString(),
Session["Last_Name"].ToString(),
Session["F_First_Name"].ToString(),
Session["F_Last_Name"].ToString(),
Session["Gender"].ToString(),
Session["Nationality"].ToString(),
Session["Maritial_Status"].ToString(),
Session["DOB"].ToString(),
Session["CNIC"].ToString(),
Session["Domicile"].ToString(),
Session["Dependents"].ToString(),
Session["Qualification_10Years"].ToString(),
Session["Board_10_Years_Edu"].ToString(),
Session["Completion_10_years"].ToString(),
Session["Percmarks_10_Years"].ToString(),
Session["Division_10_Years"].ToString(),
Session["Qualification_12Years"].ToString(),
Session["Board_12_Years_Edu"].ToString(),
Session["Completion_12_years"].ToString(),
Session["Percmarks_12_Years"].ToString(),
Session["Division_12_Years"].ToString(),
Session["Qualification_16Years"].ToString(),
Session["Board_16_Years_Edu"].ToString(),
Session["Completion_16_years"].ToString(),
Session["Percmarks_16_Years"].ToString(),null,
Session["Qualification_18Years"].ToString(),
Session["Board_18_Years_Edu"].ToString(),
Session["Completion_18_years"].ToString(),
Session["Percmarks_18_Years"].ToString(),null,
Session["Qualification_21Years"].ToString(),
Session["Board_21_Years_Edu"].ToString(),
Session["Completion_21_years"].ToString(),
Session["Percmarks_21_Years"].ToString(),null,
Session["exp_1_Organization"].ToString(),
Session["Designation_1"].ToString(),
Session["Duration_from_1_1"].ToString(),
Session["Duration_from_1_2"].ToString(),
Session["address_1"].ToString(),
Session["contact_1"].ToString(),
Session["supervisor_1"].ToString(),
Session["job_reason_1"].ToString(),
Session["starting_salary_1"].ToString(),
Session["ending_salary_1"].ToString(),
Session[" exp_2_Organization"].ToString(),
Session[" Designation_2"].ToString(),
Session[" Duration_from_2_1"].ToString(),
Session[" Duration_from_2_2"].ToString(),
Session[" address_2"].ToString(),
Session[" contact_2"].ToString(),
Session[" supervisor_2"].ToString(),
Session[" job_reason_2"].ToString(),
Session[" starting_salary_2"].ToString(),
Session[" ending_salary_2"].ToString(),
Session[" exp_3_Organization"].ToString(),
Session[" Designation_3"].ToString(),
Session[" Duration_from_3_1"].ToString(),
Session[" Duration_from_3_2"].ToString(),
Session[" address_3"].ToString(),
Session[" contact_3"].ToString(),
Session[" supervisor_3"].ToString(),
Session[" job_reason_3"].ToString(),
Session[" starting_salary_3"].ToString(),
Session[" ending_salary_3"].ToString(),
Session["permanent_address"].ToString(),
Session["current_address"].ToString(),
Session["permanent_city"].ToString(),
Session["current_city"].ToString(),
Session["permanent_country"].ToString(),
Session["phone_number"].ToString(),
Session["mobile_number"].ToString(),
Session["email_address"].ToString(),
Session["fax"].ToString(),
ref_name_1,
ref_designation_1,
ref_org_1,
ref_email_1,
ref_add_1,
ref_mobile_1,
ref_name_2,
ref_designation_2,
ref_org_2,
ref_email_2,
ref_add_2,
ref_mobile_2,
ref_name_3,
ref_designation_3,
ref_org_3,
ref_email_3,
ref_add_3,
ref_mobile_3);
}
}