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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:02:22+00:00 2026-06-12T03:02:22+00:00

I was wondering how could I retrieve the data from SQL server compact database

  • 0

I was wondering how could I retrieve the data from SQL server compact database that I just saved and insert it into textbox of newly created form. The source code is not complete, I just wanted to save space. Connection is fine, and I’m able to add data into database in the actual program. I just would like to know how to retrieve it and put it into textbox of newly created form. This is done in WinForms.Thank you!

    public void b1_Click(object sender, EventArgs e)
    {
        SqlCeCommand command = new SqlCeCommand("INSERT INTO tbl1(Name) VALUES (@Name, @LastName)", conn);
        command.Parameters.AddWithValue("@Name", t1.Text);

        command.ExecuteNonQuery();
    }


     private void b2_Click(object sender, EventArgs e)
     {    
        Form form2 = new Form();        
        form2.Show();

       t3.Location = new System.Drawing.Point(0, 35);
       t3.Size = new System.Drawing.Size(85, 15);
       //access database and insert data into textbox
       t3.Text = ?
       form2.Controls.Add(t3);

    }
  • 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-12T03:02:23+00:00Added an answer on June 12, 2026 at 3:02 am

    Well it’s not to hard to just get a value from the database, something like this should suit your needs:

    SqlCeCommand command = new SqlCeCommand("SELECT * FROM tbl1(Name) WHERE name = @Name AND last_name = @LastName", conn);
    command.Parameters.AddWithValue("@Name", "Hank");
    command.Parameters.AddWithValue("@Name", "Hill");
    SqlDataReader reader = command.ExecuteReader();
    
    t1.Text = reader.GetString(0);
    t2.Text = reader.GetString(1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

just wondering if how can we retrieve a data from stored procedure, who's return
I am trying to retrieve around 200 billion rows from a remote SQL Server.
Hi I am just learning SQL and i am trying to retrieve some data
Hi sorry still learning here and slow to learning code arguments. Just wondering could
I was wondering how could I remove one (wrongly inserted) entry/word from the ispell
I was wondering if these two queries could be combined into a single query?
I have a webpage that reads data from an external source. It can take
Our set up today takes XML data and splits that data into multiple tables
I've got a C# winapp that communicates with a java app to retrieve data
I have a CoreData-based application that retrieves data about past events from an SQLite

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.