 |
|
มันขึ้น Errors แบบนี้ครับ ทำไงดี แก้ยังไง รบกวนด้วยครับ (ผมทำโปรเจคอยู่ครับ ใกล้ส่งแล้วด้วย!!!) |
|
 |
|
|
 |
 |
|
Code
Server Error in '/WebSite Kanok' Application.
--------------------------------------------------------------------------------
String or binary data would be truncated.
The statement has been terminated.
Description: 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.
The statement has been terminated.
Source Error:
Line 17: srcCustomerProfile.InsertParameters("M_ZipCode").DefaultValue = txtZipcode.Text
Line 18: srcCustomerProfile.InsertParameters("M_UserName").DefaultValue = txtUsername.Text
Line 19: srcCustomerProfile.Insert()
Line 20: Roles.AddUserToRole(txtUsername.Text, "Member")
Line 21: Microsoft.VisualBasic.MsgBox("การสมัครสมาชิกเสร็จสมบูรณ์", MsgBoxStyle.OkOnly, "กนกวิมาน สปอร์คลับ")
Source File: D:\Project 442\WebSite Kanok\Register.aspx Line: 19
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) +109
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +57
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +207
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2433
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +148
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +949
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +242
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +289
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +117
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +377
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +235
System.Web.UI.WebControls.SqlDataSource.Insert() +16
ASP.register_aspx.btnSubmit_Click(Object sender, EventArgs e) in D:\Project 442\WebSite Kanok\Register.aspx:19
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +78
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +100
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) +2863
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2009-04-19 09:14:32 |
By :
oasiis |
View :
35464 |
Reply :
15 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
*******ต่อจากข้างบนครับ**********
คือผมเขียน code แบบนี้แล้วมัน ERROR แบบข้างบนครับ ช่วยผมหน่อยน่ะครับ
<script runat="server">
'ทำงานเมื่อผู้ใช้กรอกข้อมูลการสมัครสมาชิกเสร็จและคลิกปุ่ม ?สมัครสมาชิก?
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim status As MembershipCreateStatus
Membership.CreateUser(txtUsername.Text, txtPassword.Text, txtEmail.Text, ddlQuestion.Text, txtAnswer.Text, True, status)
If status = MembershipCreateStatus.Success Then
srcCustomerProfile.InsertParameters("M_FirstName").DefaultValue = txtFirstName.Text
srcCustomerProfile.InsertParameters("M_LastName").DefaultValue = txtLastName.Text
srcCustomerProfile.InsertParameters("M_TelNo").DefaultValue = txtPhone.Text
srcCustomerProfile.InsertParameters("M_MobileNo").DefaultValue = txtMobile.Text
srcCustomerProfile.InsertParameters("M_Address").DefaultValue = txtAddress.Text
srcCustomerProfile.InsertParameters("M_Province").DefaultValue = txtProvince.Text
srcCustomerProfile.InsertParameters("M_City").DefaultValue = ddlCity.Text
srcCustomerProfile.InsertParameters("M_ZipCode").DefaultValue = txtZipcode.Text
srcCustomerProfile.InsertParameters("M_UserName").DefaultValue = txtUsername.Text
srcCustomerProfile.Insert()
Roles.AddUserToRole(txtUsername.Text, "Member")
Microsoft.VisualBasic.MsgBox("การสมัครสมาชิกเสร็จสมบูรณ์", MsgBoxStyle.OkOnly, "กนกวิมาน สปอร์คลับ")
MultiView1.ActiveViewIndex = MultiView1.ActiveViewIndex + 1
ElseIf status = MembershipCreateStatus.DuplicateEmail Then
lblMessage.Text = "อีเมล์ซ้ำ กรุณาใส่ใหม่"
ElseIf status = MembershipCreateStatus.DuplicateUserName Then
lblMessage.Text = "ชื่อผู้ใช้ซ้ำ กรุณาใส่ใหม่"
ElseIf status = MembershipCreateStatus.InvalidEmail Then
lblMessage.Text = "คุณใส่อีเมล์ไม่ถูกต้อง"
ElseIf status = MembershipCreateStatus.InvalidPassword Then
lblMessage.Text = "คุณใส่รหัสผ่านไม่ถูกต้อง"
Else
lblMessage.Text = "เกิดข้อผิดพลาดในการลงทะเบียน กรุณาลงทะเบียนใหม่"
End If
End Sub
'ทำงานหลังจากการสมัครสมาชิกสำเร็จ
Protected Sub View3_Load(ByVal sender As Object, ByVal e As System.EventArgs)
lblShowName.Text = txtFirstName.Text
lblShowUsername.Text = txtUsername.Text
lblShowPassword.Text = txtPassword.Text
End Sub
'ทำงานเมื่อโหลดเพจขึ้นมาครั้งแรก โดยกำหนดค่า Index เริ่มต้นให้กับ MultiView1 เท่ากับ 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack Then
MultiView1.ActiveViewIndex = 0
End If
End Sub
'ทำงานหลังจากเลือกเงื่อนไขในการสมัครสมาชิกและคลิกปุ่ม ?ลงทะเบียน?
Protected Sub btnRegister_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If rdbtnAgree.Items.Item(0).Selected Then
MultiView1.ActiveViewIndex = 1
Else
Response.Redirect("~\Home.aspx")
End If
End Sub
</script>
******มันต้องการตรงไหนครับ*****
|
 |
 |
 |
 |
Date :
2009-04-19 09:35:10 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คิดว่าคุณน่าจะส่ง Parameter ที่มี Datatype ผิดประเภทไปนะครับที่ไม่ตรงกับ Datatype ใน Database
|
 |
 |
 |
 |
Date :
2009-04-20 09:20:42 |
By :
sspt |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปัญหานี้เกิดจากว่า Field ใน Database มีขนาดเล็กกว่าจำนวนข้อมูลที่จะใส่เข้าไปครับผม ลองตรวจสอบดูครับ
|
 |
 |
 |
 |
Date :
2009-04-20 11:04:13 |
By :
anucham |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
|
 |
 |
 |
 |
Date :
2010-02-14 20:08:45 |
By :
555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ได้หรือยังครับ error นี้ ผมก็เจอเหมือนกัน
|
 |
 |
 |
 |
Date :
2011-03-22 12:03:35 |
By :
kittipoth |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
String or binary data would be truncated.
ถ้าเป็น error กรณีครับ data input เยอะกว่าที่ database จะเก็บได้ครับ
|
 |
 |
 |
 |
Date :
2011-03-24 16:08:18 |
By :
dirmus |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
thank มากๆๆครับ ดาต้าเบส บรรจุข้อมูลที่นำเข้าไม่พอจริงด้วย
|
 |
 |
 |
 |
Date :
2011-12-01 10:51:21 |
By :
มกรา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณนะครับ ความรู้ใหม่ๆ
|
 |
 |
 |
 |
Date :
2011-12-24 10:32:14 |
By :
ILove |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เจอเหมือนกันอ่าา ทำไงงง ใครรู้ช่วยบอกที โปรเจคจบด้วย T^T
|
 |
 |
 |
 |
Date :
2012-11-09 14:07:13 |
By :
auiVP |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากๆ ค่ะ แก้ได้จริงๆด้วย
|
 |
 |
 |
 |
Date :
2015-01-12 14:32:52 |
By :
namaza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ปัญหานี้เกิดขึ้นได้เสมอสำหรับข้อมูลที่เป็น String ครับ
|
 |
 |
 |
 |
Date :
2015-01-14 10:32:59 |
By :
Programmer ด้อยปัญญา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
วิธีแก้ทำอย่างไรหรอครับ
|
 |
 |
 |
 |
Date :
2015-04-03 10:01:54 |
By :
tongiggabite |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ติดปัญหานี้เหมือนกัน
แก้ อย่างไรรึค่ะ เพิ่งเริ่มศึกษา งูๆปลาๆ ทำไม่ค่อยถูกค่ะ รบกวนด้วยค่ะ
|
 |
 |
 |
 |
Date :
2016-08-15 09:26:21 |
By :
far |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ไขโดยการเพิ่มขนาดของฐานข้อมูลให้เก็บจำนวนให้มากพอที่จะใส่ลงค่ะ
|
 |
 |
 |
 |
Date :
2018-04-04 14:52:50 |
By :
ipchully |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
กำลังเจอปัญหานี้เลย
คาสิโนออนไลน์
|
 |
 |
 |
 |
Date :
2018-04-09 12:37:23 |
By :
Lion88 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|