|
|
|
VB.NET กรอกแบบฟอร์มหมดแล้ว เวลากดบันทึกแล้วมันขึ้น error แบบนี้ครับ |
|
|
|
|
|
|
|
อันนี้เป็นโค๊ดหน้าที่ error ครับช่วยที
Code (VB.NET)
Try
Select Case ActionFlag
Case "Add"
sqlMember = "INSERT INTO Member (MemberID,FullName,Sex,IDCard,"
sqlMember &= " Address, Phone, MemberType,AdmitDate,ExpireDate,"
sqlMember &= " PictureFileName,IsExpired,IsMember)"
sqlMember &= " VALUES ('" & lblMemberID.Text & "',"
sqlMember &= "'" & txtFullName.Text & "',"
If optMale.Checked = True Then
sqlMember &= "'M',"
ElseIf optFemale.Checked = True Then
sqlMember &= "'F',"
End If
sqlMember &= "'" & txtIDCard.Text & "',"
sqlMember &= "'" & txtAddress.Text & "',"
sqlMember &= "'" & txtPhone.Text & "',"
sqlMember &= "'" & CStr(cboMemberType.SelectedValue) & "',"
sqlMember &= "'" & dtpAdmitDate.Value & "',"
sqlMember &= "'" & dtpExpireDate.Value & "',"
sqlMember &= "'" & tmpFileName & "',"
If CStr(cboMemberType.SelectedValue) = "1" Or CStr(cboMemberType.SelectedValue) = "2" Then
sqlMember &= "'0','1')"
ElseIf CStr(cboMemberType.SelectedValue) = "0" Then
sqlMember &= "'1','0')"
End If
Case "Edit"
sqlMember = "UPDATE Member "
sqlMember &= " SET FullName='" & txtFullName.Text & "',"
If optMale.Checked = True Then
sqlMember &= " Sex='M',"
ElseIf optFemale.Checked = True Then
sqlMember &= " Sex='F',"
End If
sqlMember &= " IDCard='" & txtIDCard.Text & "',"
sqlMember &= " Address='" & txtAddress.Text & "',"
sqlMember &= " Phone='" & txtPhone.Text & "',"
sqlMember &= " MemberType='" & CStr(cboMemberType.SelectedValue) & "',"
sqlMember &= " AdmitDate='" & dtpAdmitDate.Value & "',"
sqlMember &= " ExpireDate='" & dtpExpireDate.Value & "',"
sqlMember &= " PictureFileName='" & tmpFileName & "'"
sqlMember &= " WHERE (MemberID='" & lblMemberID.Text & "')"
End Select
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strConn
.Open()
End With
If ActionFlag = "Add" Then
tmpMSG = "คุณต้องการเพิ่มข้อมูล ใช่หรือไม่ ?"
ElseIf ActionFlag = "Edit" Then
tmpMSG = "คุณต้องการแก้ไขข้อมูล ใช่หรือไม่ ?"
End If
If MessageBox.Show(tmpMSG, "คำยืนยัน", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
With comMember
.CommandType = CommandType.Text
.CommandText = sqlMember
.Connection = Conn
.ExecuteNonQuery()
End With
End If
Catch ErrProcess As Exception
MessageBox.Show("ไม่สามารถเพิ่มสมาชิกใหม่ได้ เนื่องจาก " & ErrProcess.Message, "ข้อผิดพลาด", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End Try
|
ประวัติการแก้ไข 2013-02-22 11:53:29
|
|
|
|
Date :
2013-02-22 11:51:05 |
By :
thuadsak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ win ครับ แล้วเราจะตรวจสอบ Format ตรงไหน ครับ ผมมือใหม่จิงๆ ช่วยหน่อย ติดตรงนี้ที่เดี๋ยวก็จะเสร็จแล้วครับ
|
|
|
|
|
Date :
2013-02-22 19:40:17 |
By :
thuadsak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|