p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB.NET 2002/2003 Basics (http://p2p.wrox.com/forumdisplay.php?f=76)
-   -   Datagrid display (http://p2p.wrox.com/showthread.php?t=52934)

Lovehead January 19th, 2007 08:37 AM

Datagrid display
 
I have 2 buttons, Button A for list all employees.Button B for search employee by last name. Result is displayed in a datagrid.
Button A works when program starts and fills the datagrid with list of all employees. Button B works while data grid is displaying list of all employees, and changes the display with employees with same lastname. But after I have used button B Button, A do not work or say datagrid do not display list of all employees here is the code for Button A

        dgdEmpSearch.Visible = True
        DsEmployees1.Clear()
        daEmployees.Fill(DsEmployees1)
        dgdEmpSearch.Refresh()
Do I need to clear the datagrid before "daEmployees.Fill(DsEmployees1)" then I do not know the command to do it. Please give the command syntex too.





js

Lovehead January 20th, 2007 05:12 PM

I solved the problem and i am givving the solution for the benefit of people like me. First let me explain what is happeniong here:
To search by name is done then a command is executed. Command sysntex is daYouradopter.selectcommand.commandtext="Select * from table where empname="searchname"
now this command is forcing when button A to list all employees is clicked and display never changes. therefore i had to give daYouradopter.selectcommand.commandtext="Select * from table and now i can display all entires from the table. Here is the actual code
        dgdempSearch.Visible = True
        Dsemployee1.Clear()
        dgdempSearch.Refresh()
        daemployees.SelectCommand.CommandText = "Select * From tblemployees"
        daemployees.Fill(DsCustomers1)


js


All times are GMT -4. The time now is 05:16 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.