Protected Sub txtPur_id_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPur_id.TextChanged
Dim idx As String = Request.QueryString("Pur_id")
txtPur_id.Text = idx
Dim sql As String = "SELECT Tl_Purchase.St_id, Tl_Stock.St_name, Tl_Purchase.Pur_amount ,Tl_Purchase.Pur_id FROM Tl_Purchase INNER JOIN Tl_Stock ON Tl_Purchase.St_id = Tl_Stock.St_Id WHERE Tl_Purchase.Pur_id ='" & txtPur_id.Text & "'"
'Dim purid As String = DDLPurid.SelectedValue
'Response.Write(purid)
'Response.End()
Dim mycommand As New SqlCommand(sql, Conn)
Conn.Open()
Dim mydatareader As SqlDataReader = mycommand.ExecuteReader()
Dim found As Boolean = False
While mydatareader.Read()
found = True
End While
Conn.Close()
If found = True Then
txtPur_id.Enabled = False
Showitempurchase()
End If
End Sub
Sub Showitempurchase()
'แสดงรายการของสินค้าให้เลือก
DGRecieve.Visible = True
Dim AdapterStock As New SqlDataAdapter("SELECT Tl_Purchase.St_id, Tl_Stock.St_name, Tl_Purchase.Pur_amount ,Tl_Purchase.Pur_id FROM Tl_Purchase INNER JOIN Tl_Stock ON Tl_Purchase.St_id = Tl_Stock.St_Id WHERE Tl_Purchase.Pur_id ='" & txtPur_id.Text & "'", Conn)
'Response.Write(AdapterStock)
'Response.End()
AdapterStock.Fill(Ds, "DataPurchase")
DGRecieve.DataSource = Ds.Tables("DataPurchase")
DGRecieve.DataKeyField = "St_id"
DGRecieve.DataBind()
End Sub