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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:33:43+00:00 2026-05-31T14:33:43+00:00

I am trying to populate some text boxes on a form with data pulled

  • 0

I am trying to populate some text boxes on a form with data pulled from MySQL into a data set.
I cant seem to get the code right and could use some help

        string ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
        MySqlConnection connection;
        MySqlDataAdapter adapter;
        DataTable DTItems;



        connection = new MySqlConnection(ConnectionString);

        try
        {
            //prepare query to get all records from items table
            string query = "select * from spt_proposal where fr_Numer = "+ a+"";



            //prepare adapter to run query
            adapter = new MySqlDataAdapter(query, connection);
            DataSet DS = new DataSet();
            //get query results in dataset
            adapter.Fill(DS);
            textBox5.Text = DS.Tables[0].Rows[0].ToString();

This does not hit the text box at all.

a in the query is a variable that is pulled from a different form

and the query should pull 32 different things from the database in a row

There are about 9 text boxes on the form that i will have to fill with different data from this row.

Anyone have a better way to do this?

Brent

  • 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-31T14:33:45+00:00Added an answer on May 31, 2026 at 2:33 pm

    Try:

    textBox5.Text = DS.Tables[0].Rows[0][0].ToString(); 
    

    Remember, that a Table is pretty much a two dimensional array. Your code literally gets to the 1st row in the DataSet, but doesn’t take into account the Column.

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

Sidebar

Related Questions

I'm trying to pull some html data from a mysql database to populate a
I'm trying to load some XML into flash to populate some dynamic text fields.
I am trying to populate a text box with some data, namely the names
I have a mysql database that I'm trying to populate from a text file.
I'm trying to populate a List of beans from a form: public class Foo
I'm trying to populate a DropDownList with values pulled from a property, and my
im tryin to populate check boxes and set their values from a xml file
Hey! I am trying to put some data from a textbox to an existing
I am trying to populate a string with some information from an include file
i have a simple template that i populate with some data then im trying

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.