Solved

Visual Studio Database object

Posted on 2007-11-26
4
156 Views
Last Modified: 2010-04-23
I created a new project and I want it to be used only on a local machine. I need a database installed with the project so I added a database componet to the project.  (Project/Add Componet/Sql Database).  This is going to be a very simple database program so I don't need a lot of power.   Two questions:  1.  Did I do the right thing and 2. Where is a good reference to work with the componet.
I did a search in the help file and returned nothing of value.
0
Comment
Question by:Moed
[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
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
jcoehoorn earned 500 total points
ID: 20353890
1)  I think you need SQL Server to take proper advantage of the database component you added, but I could be wrong here.  Either way, since it's intended for local use only if you have SQL Express running on your machine you should be fine.  You can test it by going to the menu in Visual Studio and choosing View->Server Explorer.  Find your database component there (Database1.mdf is the default name), right click on it and choose 'Modify Connection'.  At the bottom of the window that opens is a button labeled 'Test Connection' that works like it's name implies.  If the test succeeds then you are fine.  

2)  To work with this component you can use the Server Explorer we just opened to add tables, columns, and the like to the database.  You can use the System.Data.SqlClient namespace to send SQL queries to the database or add new dataset components to create typed datasets for databinding with very little code.
0
 
LVL 2

Author Comment

by:Moed
ID: 20354253
I don't want to have sql server or express.  Isn't there a database object that can be added to have limited database functionality within the program?  
0
 
LVL 2

Author Comment

by:Moed
ID: 20354383
After doing a little more research I think what I want to do is privately deploy Sql CE.  Do you know of a resource that might help with that?
0
 
LVL 18

Expert Comment

by:jcoehoorn
ID: 20506957
Sql CE is a great choice.  It's not different to work with compared to regular SQL Server, so most of the examples or tutorials you find for creating SQL Server code will be very similar when applied to Sql CE.  There are two main things to keep in mind:
1) You use the system.data.sqlce namespace rather than system.data.sqlclient
2) You need to download and install the engine on your computer, and include the engine with your app's install package.  This isn't that difficult- just add the msi as a dependency and the setup project can take do it automatically.

Download the package here:
http://www.microsoft.com/sql/editions/compact/downloads.mspx
0

Featured Post

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!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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