Solved

Visual Studio Database object

Posted on 2007-11-26
4
150 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now