Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to list row data from sdf datbase

Posted on 2011-02-22
8
Medium Priority
?
707 Views
Last Modified: 2013-11-11
Hello Everyone

I am very new to databases.

Can someone please show me how to create a simple list of FirstNames (using visual basic and LINQ) from a connected sdf database

Thank you

Karl
Capture.PNG
0
Comment
Question by:KarlTheHopeless
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 34958269
Hi KarlTheHopeless;

Because you are using a sdf datbase you can not use the ORM to create the DataContect mapping the the classes in code to the database. There seems to be a work around and the steps can be found here at SQL Server Compact and LINQ . Once you have the DataContext created the query would look like:

Dim context As New DataContext()

Dim fNames = (From f in context.BasicTable _
                          Select f.FirstName).ToList()

fName will now have a List(Of String) with FirstNames.

Fernando
0
 

Author Comment

by:KarlTheHopeless
ID: 34958377
Hi Fernando

That link does not work for me.

Have you any others?

0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 34958437
I just tried it again and it is working for me. If it still not working do a google search on "SQL Server Compact and Linq". I have turned off my desk top and using a mobile device right now.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 

Author Comment

by:KarlTheHopeless
ID: 34958522
Hi Ferdinand

Yep, the link works now.

But I do not have the file SQLMetal.exe in the folder ...

C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\

That file doesn't exist on my machine.

Earlier, you said that "Because you are using a sdf datbase you can not use the ORM to create the DataContect mapping ".

Well, should I try using a different kind of database to make life simpler?

I just want to create a simple database to reside on my local machine.

Nothing particularly fancy.

But, right now, it seems that I am already having to deal with "workarounds" before I even start!

Is this a typical Microsoft shambles, or have I missed something?

Do I really have to hunt around for 'workarounds' just to set up a new database?
0
 

Author Comment

by:KarlTheHopeless
ID: 34958602
Oops! I should have said Fernando.

Apologies.
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 total points
ID: 34963136
Hi KarlTheHopeless;

To your question, "Well, should I try using a different kind of database to make life simpler?", I would be simpler if you were to use SQL Server Express it is free and can be downloaded from [HERE]. There should be no work around then.

Here is a link to Using LINQ to SQL (Part 1) by ScottGu which will show how to set up the data context he also has a link to a video he made. He has many post by the same name just change the part number.

Fernando


0
 

Author Closing Comment

by:KarlTheHopeless
ID: 34964164
Brilliant!

Thank you.
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 34964814
Not a problem, always glad to help.  ;=)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question