?
Solved

how to list row data from sdf datbase

Posted on 2011-02-22
8
Medium Priority
?
706 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 63

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 63

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 63

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 63

Expert Comment

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

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

752 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