Private Sub frmListAllProducts_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Windows.Forms.Cursor.Current = Cursors.WaitCursor
With Conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = strConn
.Open()
End With
Dim sqlProduct As String = ""
sqlProduct = "SELECT t_Product.Product_id, t_Product.Product_name, t_Product.Product_Brand,"
sqlProduct &= " t_Product.Product_Detail, t_Product.Product_Price, t_Product.Product_Total"
sqlProduct &= " FROM t_Product"
If IsFind = True Then
ds.Tables("t_Product").Clear()
End If
da = New OleDbDataAdapter(sqlProduct, Conn)
da.SelectCommand.CommandText = sqlProduct
da.Fill(ds, "t_Product") Error ตรงนี้นะค่ะลอแก้มาหลายวิธีแล้วค่ะ
If ds.Tables("t_Product").Rows.Count <> 0 Then
IsFind = True
With grdProducts
.AllowNavigation = False
.ReadOnly = True
.DataSource = ds.Tables("t_Product")
End With
Else
IsFind = False
grdProducts.DataSource = Nothing
End If
FormatDataGridWithData()
Windows.Forms.Cursor.Current = Cursors.Default
End Sub
Dim sqlProduct As String = ""
sqlProduct = "SELECT * FROM t_Product "
Date :
2012-03-16 21:49:59
By :
webmaster
No. 2
Guest
Code (VB.NET)
Dim sqlProduct As String = ""
sqlProduct = "SELECT * FROM t_Products "
sqlProduct = "SELECT t_Products.Product_id, t_Products.Product_name, t_Products.Product_Brand,"
sqlProduct &= " t_Products.Product_Detail, t_Products.Product_Price, t_Products.Product_Total"
sqlProduct &= " FROM t_Products"
If IsFind = True Then
ds.Tables("t_Products").Clear()
End If
da = New OleDbDataAdapter(sqlProduct, Conn)
da.SelectCommand.CommandText = sqlProduct
da.Fill(ds, "t_Products")
If ds.Tables("t_Products").Rows.Count <> 0 Then
IsFind = True