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 873151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:53:22+00:00 2026-05-15T10:53:22+00:00

alt text http://img24.imageshack.us/img24/3365/sqlnuts.jpg well heres the code public void select_table_names() {//start /* display all

  • 0

alt text http://img24.imageshack.us/img24/3365/sqlnuts.jpg

well heres the code


 public void select_table_names()
        {//start

/* display all tables*/ string commandString = null; SqlConnection conn = null; SqlCommand command = null; SqlDataReader reader = null; ArrayList list = new ArrayList(); try { // commandString = "SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES ";// @table "; //string columns; //string tables; //columns = "TABLE_SCHEMA"; //tables = "INFORMATION_SCHEMA.TABLES"; commandString = "SELECT @pthis FROM @tables"; //note when the @tables is replaced by info..schema, still the result is like in figure two" //commandString = "SELECT "+columns+" FROM "+tables; conn = new SqlConnection(Class1.connection); command = new SqlCommand(commandString, conn); // Add the parameters for the SelectCommand. SqlParameter table = new SqlParameter(); command.Parameters.Add("@pthis", SqlDbType.NVarChar, 100); command.Parameters.Add("@tables", SqlDbType.NVarChar, 100); //Add values to these parameters command.Parameters["@tables"].Value = "INFORMATION_SCHEMA.TABLES"; command.Parameters["@pthis"].Value = "TABLE_SCHEMA"; conn.Open(); reader = command.ExecuteReader(); GridView1.DataSource = reader; GridView1.DataBind(); // DropDownList1.DataSource = reader; // DropDownList1.DataTextField = "TABLE_NAME"; // DropDownList1.DataValueField = "TABLE_NAME"; // DropDownList1.DataBind(); reader.Close(); reader.Dispose(); conn.Close(); conn.Dispose(); }//try ends here. catch (SqlException ex) { try { reader.Close(); reader.Dispose(); conn.Close(); conn.Dispose(); } catch (Exception az) { Response.Write(az.Message); } Class1 object1 = new Class1(); object1.errorMessages = new System.Text.StringBuilder(); for (int i = 0; i < ex.Errors.Count; i++) { object1.errorMessages.Append("\n135 \n" + "Index #" + i + "\n" + "Message: " + ex.Errors[i].Message + "\n" + "LineNumber: " + ex.Errors[i].LineNumber + "\n" + "Source: " + ex.Errors[i].Source + "\n" + "Procedure: " + ex.Errors[i].Procedure + "\n"); } Response.Write(object1.errorMessages.ToString()); }//sql catch ends here catch (Exception all) { Label1.Text = "153 all\n" + all.ToString(); try { reader.Close(); reader.Dispose(); conn.Close(); conn.Dispose(); } catch (Exception zx) { Label5.Text = "connection 192 " + zx.Message; } Response.Write(all.Message.ToString()); }//catch all ends }//select_table_names
  • 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-05-15T10:53:23+00:00Added an answer on May 15, 2026 at 10:53 am

    SQL Server will definately not allow the use of a variable as a table name. As for your column name variable, it will return the number of results that the table has, but it will output TABLE_SCHEMA.

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

Sidebar

Related Questions

alt text http://img243.imageshack.us/img243/3249/50263677.jpg Global.asax Code: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL with
The questions: alt text http://img12.imageshack.us/img12/2706/image2ot.jpg What I've done: alt text http://img29.imageshack.us/img29/9192/image3sc.jpg But I've got
alt text http://img195.imageshack.us/img195/7845/tabx.jpg i am opening tabs with click event on tree list view.
I'm wondering how to create windows like these alt text http://img824.imageshack.us/img824/997/this.jpg I'm refering to
I am trying to mutlipivot source data (as below ) alt text http://img532.imageshack.us/img532/5418/sourcex.jpg want
alt text http://img14.imageshack.us/img14/2055/sof.jpg HTML markup: <div class=planRisk> <div class=innerPlanRiskRight> <div class=rmPlanFrequency>10 </div> <div class=rmPlanSeverity>
I have the following three tables: alt text http://img16.imageshack.us/img16/5499/linqtosqlquery.jpg With LinqToSql I would like
i have 2 views in my App 1:Views->Season->ViewSeason alt text http://img102.imageshack.us/img102/9207/viewsseasonsx4.jpg 2:Views->Admin->Season->ViewSeason alt text
With reference to this programming game I am currently building. alt text http://img12.imageshack.us/img12/2089/shapetransformationf.jpg To
alt text http://img42.imageshack.us/img42/4161/blinkthru.png I'm trying to get the validation to not show through my

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.