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 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://img14.imageshack.us/img14/2055/sof.jpg HTML markup: <div class=planRisk> <div class=innerPlanRiskRight> <div class=rmPlanFrequency>10 </div> <div class=rmPlanSeverity>
Look at this image: alt text http://img139.imageshack.us/img139/4488/picture2ep3.png I know how to add UITableView with
The picture below explains all: alt text http://img133.imageshack.us/img133/4206/accentar9.png The variable textInput comes from File.ReadAllText(path);
I have a products table... alt text http://img357.imageshack.us/img357/6393/productscx5.gif and a revisions table, which is
i've got this tables in my database. alt text http://img166.imageshack.us/img166/3133/testdbschemafy5.png With Entity Framework i
alt text http://img21.imageshack.us/img21/3262/snapshotosz.png I want to add a new tab or site in sharepoint
alt text http://img14.imageshack.us/img14/5020/whatbox.png I dont know what this is called, but you have 2
alt text http://img42.imageshack.us/img42/4161/blinkthru.png I'm trying to get the validation to not show through my
alt text http://img248.imageshack.us/img248/1797/updatetable.png Update Combined column using CategoryCode of every OrderId. In this example
alt text http://img375.imageshack.us/img375/9830/combobox.png Setting the IsHitTestVisible=false has the effect of having the whole ComboBox's

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.