Solved

Visual Studio Database object

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

806 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