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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:20:08+00:00 2026-05-18T08:20:08+00:00

I write a little Chat Application. To save some infos like Username and Password

  • 0

I write a little Chat Application. To save some infos like Username and Password I store the Data in an SQL-Compact 3.5 SP1 Database.

Everything working fine, but If another (the same .exe on the same machine) Client want to access the Service. It came an EndpointNotFound exception, from the ServiceReference.Class.Open() at the Second Client.

So i remove the CE Data Access Code and I get no Error (with an if (false))

Where is the Problem?
I googled for this, but no one seems the same error I get 🙁

SOLUTION

I used the wrapper in
http://csharponphone.blogspot.com/2007/01/keeping-sqlceconnection-open-and-thread.html
for threat safty, and now it works 🙂


Client Code:

public test()
{
    var newCompositeType = new Client.ServiceReference1.CompositeType();
    newCompositeType.StringValue = "Hallo" + DateTime.Now.ToLongTimeString();

    newCompositeType.Save = (Console.ReadKey().Key == ConsoleKey.J);

    ServiceReference1.Service1Client sc = new Client.ServiceReference1.Service1Client();
    sc.Open(); 
    Console.WriteLine("Save " + newCompositeType.StringValue);
    sc.GetDataUsingDataContract(newCompositeType);
    sc.Close();
}

Server Code

public CompositeType GetDataUsingDataContract(CompositeType composite)
{
    if (composite.Save)  
    {
        SqlCeConnection con = new SqlCeConnection(Properties.Settings.Default.Con);
        con.Open();

        var com = con.CreateCommand();
        com.CommandText = "SELECT * FROM TEST";

        SqlCeResultSet result = com.ExecuteResultSet(ResultSetOptions.Scrollable | ResultSetOptions.Updatable);

        var rec = result.CreateRecord();
        rec["TextField"] = composite.StringValue;
        result.Insert(rec);



        result.Close();
        result.Dispose();
        com.Dispose();
        con.Close();
        con.Dispose();  
    }    
    return composite;
}
  • 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-18T08:20:09+00:00Added an answer on May 18, 2026 at 8:20 am

    I used the wrapper in http://csharponphone.blogspot.com/2007/01/keeping-sqlceconnection-open-and-thread.html for threat safty, and now it works 🙂

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

Sidebar

Related Questions

I like to write a little server application being controlled by a little console
I need to write a little wizard application into which a user inputs some
I'm trying to write a little SQL Helper. I have a query like this
I'd like to write a little book on personal topics together with two friends
I write a little raytracer and i'd like to query how many cpu cores
I want to write a little application for myself to learn C# and WPF.
I want to write a little Singleton class that looks like: #include <vector> class
I'm trying to write a little WordPress plugin to support some migrated content. The
I'd like to write a little class that adds a Day/Month box showing the
I would like to write a little code that copy on a local pc

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.