|
|
|
ช่วยดู Error >> Operation is not valid due to the current state of the object. ด้วยคะ |
|
|
|
|
|
|
|
Code มาดูครับ ? หรือไม่ก็ลอง Debug ดู Line ที่มีปัญหาครับ ไม่ยากจริง ๆ
|
|
|
|
|
Date :
2012-02-24 17:28:35 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันเป็นตรงปุ่มกดคะ ครั้งแรกข้อมูลโชว์ปกติ แต่พอกดอีกครั้งก็ขึ้น Error
Code (VB.NET)
Protected Sub btnList_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnList.Click
prListData()
End Sub
Sub prListData()
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strConn
.Open()
End With
SQLWrk = "Select M.CustCode,isnull(M.Title,'')+' '+isnull(M.CustName,'')+' '+isnull(M.CustSurname,'') As CustName "
SQLWrk = SQLWrk & ",M.SaleBy,isnull(E.ThaiFirstName,'')+' '+isnull(E.ThaiLastName,'') As EmpName,M.CreditLitmit "
SQLWrk = SQLWrk & ",M.Address1,M.Address2,M.Address3,M.Province,M.ZipCode,V.VatPcnt "
SQLWrk = SQLWrk & "From tbMTCustomer M "
SQLWrk = SQLWrk & "Left Join tbMTEmployee E On M.CompanyCode = E.CompanyCode And M.SaleBy = E.EmpCode "
SQLWrk = SQLWrk & "Left Join tbMTVat V On M.CompanyCode = V.CompanyCode And M.VatCode = V.VatCode "
SQLWrk = SQLWrk & "Where M.CompanyCode='" & Session("gSCompanyCode") & "' "
If txtCust.Text <> "" Then
SQLWrk = SQLWrk & "And (M.CustCode like '%" & txtCust.Text & "%' Or M.CustName like '%" & txtCust.Text & "%') "
End If
SQLWrk = SQLWrk & "Order By M.CustCode "
da = New SqlDataAdapter(SQLWrk, Conn)
da.Fill(ds, "ListData")
sb.Append("<table border = '0' cellpadding='2' cellspacing='2' align='center' width='99%' >")
sb.Append("<tr bgcolor=" & gColorH1 & ">")
sb.Append("<td align='center' class='trHead'><b>รหัสลูกค้า</b></td>")
sb.Append("<td align='left' class='trHead'><b>ชื่อลูกค้า</b></td>")
sb.Append("<td align='left' class='trHead'><b>พนักงานขาย</b></td>")
sb.Append("<td align='center' class='trHead'><b>เครดิต</b></td>")
sb.Append("</tr>")
If ds.Tables("ListData").Rows.Count <> 0 Then
Dim iCnt As Integer = 0
While iCnt < ds.Tables("ListData").Rows.Count
If iCnt Mod 2 = 0 Then
sb.Append("<tr bgcolor=" & gColor1 & ">")
Else
sb.Append("<tr bgcolor=" & gColor2 & ">")
End If
sb.Append("<td align='center'><a href='javascript:fnSelect(" & (iCnt) & ")'>")
sb.Append(ds.Tables("ListData").Rows(iCnt)("CustCode") & "</a></td>")
sb.Append("<td align='left'>" & ds.Tables("ListData").Rows(iCnt)("CustName") & "</td>")
sb.Append("<td align='left'>" & ds.Tables("ListData").Rows(iCnt)("EmpName") & "</td>")
sb.Append("<td align='center'>" & ds.Tables("ListData").Rows(iCnt)("CreditLitmit") & "</td>")
sb.Append("<input type='hidden' name='hReturn" & (iCnt) & "' id='hReturn" & (iCnt) & "'")
sb.Append("runat='server' value='" & Server.UrlEncode(ClsUtility.gfnPadStr(8, ds.Tables("ListData").Rows(iCnt)("CustCode"))))
sb.Append(ClsUtility.gfnPadStr(288, ds.Tables("ListData").Rows(iCnt)("CustName")))
sb.Append(ClsUtility.gfnPadStr(80, clsApp.checkNull(ds.Tables("ListData").Rows(iCnt)("Address1"))))
sb.Append(ClsUtility.gfnPadStr(80, clsApp.checkNull(ds.Tables("ListData").Rows(iCnt)("Address2"))))
sb.Append(ClsUtility.gfnPadStr(80, clsApp.checkNull(ds.Tables("ListData").Rows(iCnt)("Address3"))))
sb.Append(ClsUtility.gfnPadStr(40, clsApp.checkNull(ds.Tables("ListData").Rows(iCnt)("Province"))))
sb.Append(ClsUtility.gfnPadStr(10, clsApp.checkNull(ds.Tables("ListData").Rows(iCnt)("ZipCode"))))
sb.Append(ClsUtility.gfnPadStr(8, ds.Tables("ListData").Rows(iCnt)("SaleBy")))
sb.Append(ClsUtility.gfnPadStr(160, ds.Tables("ListData").Rows(iCnt)("EmpName")) & "' />")
'sb.Append(ClsUtility.gfnPadStr(10, CStr(clsApp.GetFormatCurrency(ds.Tables("ListData").Rows(iCnt)("CreditLitmit"), 2))))
'sb.Append(ClsUtility.gfnPadStr(10, CStr(clsApp.GetFormatCurrency(ds.Tables("ListData").Rows(iCnt)("VatPcnt"), 2))) & "' />")
iCnt += 1
End While
End If
sb.Append("</table><hr />")
display.InnerHtml = sb.ToString()
Conn.Close()
ds.Tables("ListData").Clear()
End Sub
|
|
|
|
|
Date :
2012-02-24 17:39:28 |
By :
MinNiie |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วคร้า ขอบคุณมากคร้า
|
|
|
|
|
Date :
2014-04-23 11:25:14 |
By :
Nooau |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thank
|
|
|
|
|
Date :
2014-10-25 16:23:11 |
By :
เรก |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|