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

x
?
Solved

Visual Studio Database object

Posted on 2007-11-26
4
Medium Priority
?
170 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:
Joel Coehoorn earned 1500 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:Joel Coehoorn
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

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 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