Sub ViewData()
'*** DataTable ***'
Dim dtAdapter As SqlDataAdapter
Dim dt As New DataTable
strSQL = "SELECT * FROM customer WHERE CustomerID = '"& Request.QueryString("CustomerID") &"' "
dtAdapter = New SqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
If dt.Rows.Count > 0 Then
Me.txtCustomerID.Text = dt.Rows(0)("CustomerID")
Me.txtName.Text = dt.Rows(0)("Name")
Me.txtEmail.Text = dt.Rows(0)("Email")
Me.txtCountryCode.Text = dt.Rows(0)("CountryCode")
Me.txtBudget.Text = dt.Rows(0)("Budget")
Me.txtUsed.Text = dt.Rows(0)("Used")
End IF
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim _q = Request.QueryString("q")
If (_q IsNot Nothing) Then
If _q.Trim() <> "" Then
Dim db As New dbIndirectDataContext()
Dim ts = From t In db.Products
Where t.Product_ID.Contains(_q)
Order By t.Product_ID Descending
Select New With {
.Product_ID = t.Product_ID,
.Product_Name = t.Product_Name,
.Product_Detail = t.Product_Detail,
.Product_Unit = t.Product_Unit,
.Product_Price = t.Product_Price,
.Product_Quantity = t.Product_Quantity
}
If ts.Count() > 0 Then
TextName.Text = ts.Intersect("Product_Name"),
TextDetail.Text = ts.Intersect("Product_Detail"),
TextUnit.Text = ts.Intersect("Product_Unit"),
TextPrice.Text = ts.Intersect("Product_Price"),
TextQuantity.Text = ts.Intersect("Product_Quantity"),
End If
Else
Response.RedirectPermanent("StockIN.aspx")
End If
End If
End Sub
Protected Sub cmdSearch_Click(sender As Object, e As System.EventArgs) Handles cmdSearch.Click
If textID.Text.Trim() <> "" Then
Response.RedirectPermanent("StockIN.aspx?q=" & textID.Text.Trim())
End If
End Sub