Results 1 to 2 of 2

Thread: how to Select variable range using OleDbCommand

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2018
    Posts
    10

    how to Select variable range using OleDbCommand

    Hi

    Users can select a range 50 to 600 in a chart panel. Currently I m using:

    Code:
    Dim myCommand As New OleDbCommand("Select * From [Delay$h1:u601]", myConnection)
    But I want the "u601" to be a variable based on what the user selects. That way when i read the data in it will already be the reduced size for the chart graph. I searched and some use {} but that doesnt to work for me.

    Can someone give me a variable based to select data from the Delay excel sheet starting at h1 please?

    Thanks.

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

    Re: how to Select variable range using OleDbCommand

    Obviously you need a WHERE clause if you want to filter the data. You just need to use one or more parameters if you want the filter values to be variable. Follow the Blog link in my signature below and check out my post on Parameters In ADO.NET to learn how to do that.
    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

Tags for this Thread

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