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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:07:52+00:00 2026-05-26T13:07:52+00:00

I am a newbie in C#. I created a local database in VS2010(.sdf file).

  • 0

I am a newbie in C#.

I created a local database in VS2010(.sdf file). I am trying to create some comparisons between database columns. I successfully connected with the database using the connectionstring below:

 string connectionString = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;data source=c:\\users\\user\\documents\\visual studio 2010\\Projects\\myapp\\myapp\\mydb.sdf";

My database has two tables. Nicknames and Names.
Nicknames has one field called “Alias” which simply lists the nicknames stored.
Names has one field called “Text” which simply lists the names stored.

Ex:

Alias

Masher
Jones
Jaime
John
Joker

Names

John
Adam
Matt
Jones

Let’s say these are the values in my database. What I want is to find the nicknames who aren’t in the table of Names which is -> Masher, Jaime and Joker in my example.

How would i do that? I am using C# and VS2010.

Here is what i tried in terms of SQL codes:

 "SELECT Alias FROM nicknames WHERE (NOT (Alias IN(SELECT Text FROM Names))) ";
         "SELECT Alias FROM nicknames EXCEPT SELECT Text FROM Names";
         "SELECT Alias FROM nicknames t LEFT JOIN Names m ON m.Text = t.Alias WHERE m.Text IS NULL";
         "SELECT Alias FROM nicknames UNION SELECT Text FROM Names";

What should i do?

EDIT

 OleDbConnection conn = new OleDbConnection(connectionString);
        conn.Open();
 string sql = "MYQUERYFROMTHEABOVEEXAMPLE";
 OleDbCommand cmd = new OleDbCommand(sql, conn);
             OleDbDataReader reader;
             reader = cmd.ExecuteReader();
             string result = "";
             while (reader.Read())
            {
            result += reader.GetString(0) + "\n";
  }  

This is what i use to read the results.

  • 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-26T13:07:52+00:00Added an answer on May 26, 2026 at 1:07 pm

    Try:

    SELECT Alias FROM nicknames WHERE Alias not in (SELECT Text FROM Names)
    

    Edit: Try this instead:

    select a.Alias
    from nicknames a left outer join Names n on a.alias = n.text 
    where n.text IS NULL
    

    My attempt @ your code (Ignore the fact I use SQL syntax as that’s what I work with):

    enter image description here

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

Sidebar

Related Questions

I'm trying to solve this newbie puzzle: I've created this function: def bucket_loop(htable, key):
So I'm a newbie to TDD, and I successfully created a nice little sample
i am newbie of c# and win phone 7 i create a simple database
Am a Oracle PL/SQL newbie. Basically, I have a table created as follows: CREATE
I am a newbie at WCF. I created a WCF restful service in VS2010
I'm an arcGIS newbie and I'm trying to visualize a map I've created with
a newbie question here... I've created an entity data model (.edmx) file in one
I'm newbie with .NET Entity Framework 4.0 I'm using VS2010 and I created the
newbie here. I successfully created a chat server using c# (server partial code below,
I'm a Rails newbie.... Here's what I'm trying to do.... I created a scaffold

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.