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

  • SEARCH
  • Home
  • 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 8463861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:34:16+00:00 2026-06-10T14:34:16+00:00

I’m getting an error when running the following code thru an ASP/ C# .NET

  • 0

I’m getting an error when running the following code thru an ASP/ C# .NET page:

 SELECT 1 FROM [database].INFORMATION_SCHEMA.TABLES 
 WHERE TABLE_TYPE='BASE TABLE' AND TABLE_NAME='example_table'

The code runs perfectly when I run it in the sql management studio query window.
It’s also only broken for 1 specific server – when I run on a different server with a different connection string, it works fine.

I’ve scoured the internet, and all I can seem to find as an answer is that there are issues with case sensitivity, but I’m using all uppercase, and the table in question is using SQL_Latin1_General_CP1_CI_AS collation anyway.

Based on all this, I’m pretty sure it’s some kind of permissions issue, but I’m not really sure where to look.

The error I’m getting:

Invalid object name ‘database.INFORMATION_SCHEMA.TABLES’.

The connection string:

<add name="connectionName" connectionString="Data Source=servername; Initial Catalog=master; User ID=user; Password=pw" providerName="System.Data.SqlClient"/>

UPDATE:

Some more information: I had adapted this code from some older VB stuff that basically does the same thing. The VB code runs the same exact query on the same servers and databases, but it works.

The VB code:

Dim connStr As String = ConfigurationManager.ConnectionStrings("connectionName").ConnectionString
Dim objConnection As SqlConnection = New SqlConnection(connStr)
Dim objCommand As SqlCommand = New SqlCommand("SELECT 1 FROM [database].INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_NAME='example_table'", objConnection)
objCommand.CommandType = CommandType.Text

objConnection.Open()

The C# and VB code both use the exact same connection string from web.config, so I suppose that leads me to doubt that it would be a permissions issue. Still no clue what the problem is though.

  • 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-10T14:34:17+00:00Added an answer on June 10, 2026 at 2:34 pm

    After a bunch more debugging, I was able to determine that the code was actually running on the wrong server. So, not really any way to find the bug based on what I’d posted, but I think Tony was on the right track based on the back-and-forth.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I have a view passing on information from a database: def serve_article(request, id): served_article
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.