Results 1 to 2 of 2

Thread: fill and filter datagridview by stored procedure

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    fill and filter datagridview by stored procedure

    Hi All.
    I create stored procedure to fill datagridview
    Code:
    SELECT Emp_id ,ADate ,Position, FName ,LName
    FROM Employee
    Now I modified form insert in menu DateTimePicker field to filter DGV. How to change stored procedure to filter DGV?
    Thanks.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: fill and filter datagridview by stored procedure

    You would add a where clause with a parameter to the sproc:
    Code:
    WHERE ADate = @ADate
    Then you'd add a parameter to the Command you're using to execute the sproc:
    vb.net Code:
    1. myCommand.Parameters.Add("@ADate", SqlDbType.DateTime)
    then you'd set the parameter value from your DTP:
    vb.net Code:
    1. myCommand.Parameters("@ADate").Value = myDateTimePicker.Value.Date
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width