Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8381637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:44:21+00:00 2026-06-09T16:44:21+00:00

I am trying to extract one integer from the database but am getting errors

  • 0

I am trying to extract one integer from the database but am getting errors

My code in the controller is:

        Dim SeqNumQuery = From a In db.RequestedServices
                          Where a.RequestedServiceId = id
                          Select a.StationId

        Dim StationId As Integer = SeqNumQuery.ToString

And error is:

Range variable ‘StationId’ hides a variable in an enclosing block or a range variable previously defined in the query expression.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:44:22+00:00Added an answer on June 9, 2026 at 4:44 pm

    I think the issue is that your variable, StationId, is being declared somewhere already within the same scope. Try changing to:

    Dim SeqNumQuery = From a In db.RequestedServices
                              Where a.RequestedServiceId = id
                              Select a.StationId
    
    StationId = SeqNumQuery.ToString
    

    But look into what the other variable is being used for. If you need it, use something other than StationId for your variable name, for example RequestedServicesStationId.

    More information regarding this error:

    Range variable hides a variable in an enclosing block or a range variable previously defined in the query expression.


    On a side note, I don’t understand why you are using .ToString extension method. This won’t cause your script to throw an exception, however I would recommend changing this to CInt():

    StationId = CInt(SeqNumQuery)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to extract a string from a text file using 2 delimiters. One
I have a database from which I am trying to extract certain information. The
I am trying to extract all the images from a pdf using itextsharp but
Hi im trying to extract a file from my embedded resource but the issue
I'm trying to extract one or more urls from a plain text string in
In PHP I am having difficulty trying to extract row data from one SQL
I'm trying to extract two blocks of code from a text file using Java
In my code I am trying to extract some data from a file. I
I'm trying to extract an anchor tag and everything behind it from a url
I'm trying to extract the subdomain from the HTTP_HOST value. However I've stumbled into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.