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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:29:31+00:00 2026-05-31T09:29:31+00:00

i’m a newbie in.net and im try to create a simple site. I have

  • 0

i’m a newbie in.net and im try to create a simple site.

I have this textbox that is multiline and has fix width and height.

<asp:TextBox ID="TextBox1" runat="server" Height="168px" TextMode="MultiLine" 
                            Width="303px"></asp:TextBox>

i have also created a web.config to connect to my sql database:

<connectionStrings>
<add name="TDBSConnectionString" connectionString="Data Source=local;Initial Catalog=IBSI;Persist Security Info=True;User ID=sa;Password=1"
  providerName="System.Data.SqlClient" />

How can i retrieve a data from my database and display the content into the textbox above.
i use multiline because the data is more than one.

  • 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-31T09:29:33+00:00Added an answer on May 31, 2026 at 9:29 am

    have look to this msdn tutorial : Retrieving Data Using the DataReader

    Sample:

            SqlDataReader rdr = null;
            SqlConnection con = null;
            SqlCommand cmd = null;
    
            try
            {
                // Open connection to the database
                string ConnectionString = "server=xeon;uid=sa;"+
                    "pwd=manager; database=northwind";
                con = new SqlConnection(ConnectionString);
                con.Open();
    
                // Set up a command with the given query and associate
                // this with the current connection.
                string CommandText = "SELECT FirstName, LastName" +
                                     "  FROM Employees" +
                                     " WHERE (LastName LIKE @Find)";
                cmd = new SqlCommand(CommandText);
                cmd.Connection = con;
    
                // Add LastName to the above defined paramter @Find
                cmd.Parameters.Add(
                    new SqlParameter(
                    "@Find", // The name of the parameter to map
                    System.Data.SqlDbType.NVarChar, // SqlDbType values
                    20, // The width of the parameter
                    "LastName"));  // The name of the source column
    
                // Fill the parameter with the value retrieved
                // from the text field
                cmd.Parameters["@Find"].Value = txtFind.Text;
    
                // Execute the query
                rdr = cmd.ExecuteReader();
    
                // Fill the list box with the values retrieved
                lbFound.Items.Clear();
                while(rdr.Read())
                {
                    lbFound.Items.Add(rdr["FirstName"].ToString() +
                    " " + rdr["LastName"].ToString());
                }
            }
            catch(Exception ex)
            {
                // Print error message
                MessageBox.Show(ex.Message);
            }
            finally
            {
                // Close data reader object and database connection
                if (rdr != null)
                    rdr.Close();
    
                if (con.State == ConnectionState.Open)
                    con.Close();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.