Private Sub SELECTGRID()
Dim sqlPT1 As String
sqlPT1 = "SELECT * FROM taxpt1,taxpayers WHERE pt1_uid=u_id ORDER BY pt1_ZBL ASC"
If IsFind = True Then
ds.Tables("Sql1").Clear()
End If
da = New MySqlDataAdapter(sqlPT1, Conn)
da.Fill(ds, "Sql1")
If ds.Tables("Sql1").Rows.Count <> 0 Then
IsFind = True
With DataGridView1
.DataSource = ds.Tables("Sql1")
End With
Call Datagrid1Format()
Else
IsFind = False
DataGridView1.DataSource = Nothing
MsgBox("ไม่พบข้อมูลแปลงที่ดิน", , "รายงานข้อมูลทรัพย์สิน")
Exit Sub
End If
End Sub
Dim sql As New Connectmysql
Dim newstxt as string=""
Dim str As String = "select * from tb_agencies"
Dim dt As DataTable = sql.Sqlselect(str)
For i As Integer = 0 To dt.Rows.Count - 1
If (dt.Rows(i)(0).ToString) = 0 Then
newstxt ="ไม่พบค่า"
Else
newstxt =dt.Rows(i)(0).ToString
End If
.Rows.Add(newstxt, dt.Rows(i)(1).ToString, dt.Rows(i)(2).ToString, dt.Rows(i)(3).ToString, dt.Rows(i)(4).ToString)
Next
Private Sub SELECTGRID()
Dim sqlPT1 As String
Dim SelectTXT As String = ""
sqlPT1 = "SELECT * FROM taxpt1,taxpayers WHERE pt1_uid=u_id ORDER BY pt1_ZBL ASC"
If IsFind = True Then
ds.Tables("Sql1").Clear()
End If
da = New MySqlDataAdapter(sqlPT1, Conn)
da.Fill(ds, "Sql1")
If ds.Tables("Sql1").Rows.Count <> 0 Then
IsFind = True
For i As Integer = 0 To ds.Tables("Sql1").Rows.Count - 1
With ds.Tables("Sql1")
'ข้อมูลผู้เสียภาษี
Dim uid As Integer = CInt(.Rows(i)("u_id"))
Dim fullname As String = .Rows(i)("u_nam").ToString & "" & .Rows(i)("u_name").ToString & " " & .Rows(i)("u_sname").ToString & " " & .Rows(i)("u_partnership").ToString
Dim address1 As String = .Rows(i)("u_home").ToString & " ม." & .Rows(i)("u_moo").ToString
Dim address2 As String = .Rows(i)("u_locality").ToString
'ข้อมูลแปลงที่ดิน
Dim p1_id As Integer = CInt(.Rows(i)("u_id"))
Dim ZBL As String = .Rows(i)("pt1_ZBL").ToString
Dim pt1_teedin As String = .Rows(i)("pt1_document").ToString & " " & .Rows(i)("pt1_docnum").ToString & " เลขที่ " & .Rows(i)("pt1_num").ToString & " หน้า " & .Rows(i)("pt1_serway").ToString & " จำนวน " & .Rows(i)("pt1_ri").ToString & "-" & .Rows(i)("pt1_ngang").ToString & "-" & .Rows(i)("pt1_va").ToString
Dim pt1_use1 As String = .Rows(i)("pt1_use1").ToString
Dim pt1_usecom As String = .Rows(i)("pt1_usecom").ToString
End With
Next
Call Datagrid1Format()
Else
IsFind = False
DataGridView1.DataSource = Nothing
MsgBox("ไม่พบข้อมูลแปลงที่ดิน", , "รายงานข้อมูลทรัพย์สิน")
Exit Sub