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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:48:36+00:00 2026-06-15T11:48:36+00:00

I created with Visual Studio 2010 Express a Sql Compact Database (sdf-File), with several

  • 0

I created with Visual Studio 2010 Express a Sql Compact Database (sdf-File), with several tables and relations. From this database I generated a strongly typed dataset.

Now I want to fill the dataset with the content from the database.
So I used following code to connect to the database and fill the dataset.

//My strongly typed dataset
localData = new LokalStorageDataSet();

//SqlCe-Connection
localConnection = new SqlCeConnection(@"Data Source=|DataDirectory|\TempStorage.sdf; Password='xyc';Persist Security Info=True");

localConnection.Open();
SqlCeCommand command = new SqlCeCommand("SELECT * FROM progstates", localConnection);
localDataAdapter = new SqlCeDataAdapter(command);

localDataAdapter.Fill(localData);

The problem is that no rows were added to my dataset, although in the database there are rows.
If I use a SqlCeReader to read the results of the SqlCeCommand, the reader return the rows:

SqlCeDataReader dr = command.ExecuteReader();

        while (dr.Read())
        {
          ...
        }

Can you give me the reason why my dataset don’t get the rows from the table in the dataset?

EDIT: I saw that in my dataset a new datatable were created named ‘Table’ with the same columns like the one I requested (progstate) but also this datatable has a rowCount of 0.

  • 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-15T11:48:37+00:00Added an answer on June 15, 2026 at 11:48 am
    EDITED *****
    
    Try This :-
    
    //My strongly typed dataset
    localData = new LokalStorageDataSet();
    
    //SqlCe-Connection
    localConnection = new SqlCeConnection(@"Data Source=|DataDirectory|\TempStorage.sdf; Password='xyc';Persist Security Info=True");
    
    
    SqlCeCommand command = new SqlCeCommand("SELECT * FROM progstates", localConnection);
    
    localConnection.Open();
    
    var dataReader = command.ExecuteReader();
    
    localData.Load(dataReader,LoadOption.Upsert,localData.Tables[0]);
    
    localConnection.Close();
    

    Or You cant do this with DataAdapter like this :-

    localDataAdapter = new SqlCeDataAdapter();
    
    SqlCeCommand command = new SqlCeCommand("SELECT * FROM progstates", localConnection);
    
    localDataAdapter.SelectCommand = command;
    
    localConnection.Open();
    
    localDataAdapter.SelectCommand.ExecuteNonQuery();
    localDataAdapter.Fill(localData.Tables[0]);
    
    localConnection.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created SQL Server database by Visual Studio 2010 Ultimate means in Visual
I have created SQL Server 2008 Database project using visual studio 2010. after build
I am using SQL Server Express edition for my application (Visual Studio 2010 Ultimate,
I created a WPF application in Visual Studio 2010 Express (C#) and added the
I have a C# project that I have created in Visual Studio Express 2010.
I have created a database with 8 tables in SQL Server Management Studio on
I am using visual studio 2010 Express. I have created a website in asp.net.It
I have created a website using Visual Studio 2010 Express and pasted it inside
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; using Northwind; N00b here, Trying to customize a asp.net gridview
I have created a simple Visual Studio Express 2010 C++ project using GLUT and

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.