I am trying to get a message to pop up when there are no successful search results that says "item not found"
here is my code
No matter what I do, columns.count always equals 0 no matter what. Even if I do a succesful search and a 5 columned datagrid appears, columns count = 0. Ideas? I just want to display the erro if nothing shows up.
here is my code
Sql = "SELECT Product_no, Name, Description, Unit_price, Qty_in_stock, Notes FROM PRODUCT WHERE PRODUCT_no ='" & value & "'"
Cmd = New OleDb.OleDbCommand(Sql, Con)
Con.Open()
Reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
datagrid.DataSource = Reader
datagrid.DataBind()
If datagrid.Columns.Count.Equals(0) Then
lblstatus.Text = "Item not found. Please try again."
End If
Con.Close()
No matter what I do, columns.count always equals 0 no matter what. Even if I do a succesful search and a 5 columned datagrid appears, columns count = 0. Ideas? I just want to display the erro if nothing shows up.