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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:15:59+00:00 2026-06-12T09:15:59+00:00

I need some help in understanding my error. I want to read data from

  • 0

I need some help in understanding my error. I want to read data from table, however I get error such as “no data exist for the row/column”. I dont understand it, since I actually have rows and columns in there. WinForms. Thanks!

    //this is how i insert data into table, works fine 
    public void b1_Click(object sender, EventArgs e)
    {
        SqlCeCommand command = new SqlCeCommand("INSERT INTO tbl1(Name, LastName) VALUES (@Name, @LastName)", conn);
        command.Parameters.AddWithValue("@Name", l1.Text);
        command.ExecuteNonQuery();
    }

    //this is how i try to read data from the same table
    public void b2_Click(object sender, EventArgs e)
    { 
       SqlCeConnection conn = new SqlCeConnection(@"Data Source=C:test.sdf");
       conn.Open();
       SqlCeCommand command = new SqlCeCommand("SELECT * FROM  tbl1", conn);
       SqlCeDataReader reader = command.ExecuteReader();

       //error here
       string Name = reader.GetString(0);
       label.Text = Name;
    }
  • 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-12T09:16:00+00:00Added an answer on June 12, 2026 at 9:16 am

    Problem is with your results’ loading.

    SqlCeDataReader reader = command.ExecuteReader();
    
    while (reader.Read())
    {
       string Name = reader.GetString(0);
    }
    

    So you use the Read method to iterate through the results. Or, if you just have one result then you can also use the ExecuteScalar

    string Name = reader.ExecuteScalar().ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help understanding some of the points from Paul Graham’s What Made
I need some help understanding what's happening here. This code is from a models/log.py
I'm writing a C++ program and I need some help understanding an error. By
I need some help understanding how to utilize fgetcsv and arrays to manipulate data.
I need some help understanding this bit of code pre { white-space: pre; white-space:
OK, I need some help understanding the process behind Facebook's website integration process and
Oracle's PL/SQL is fairly new to me, so I need some help understanding if
I need some help in understanding when and why to use Remote Service instead
I need some help in understanding what is happening here .I am getting a
I have been trying out Cassandra and need some help in understanding a few

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.