Friday, February 24, 2012

local database in c#

Hi,

I want to create a database in a path specified by the user at runtime when he selects a menu item like File/New. My preference is to not require the user to run an sql server on his machine to run my application. All my searches on the web for this keep directing me to the code that creates a database on an sql server but I don't want that. I want the application to create the database at runtime at a place where the user chooses. I would appreciate either a snippet of code or a link to somewhere helpful please.

Hi,

MS Access is the solution for u. It does not require any extra files to work. It just need MDAC to be installed and it's shipped with Windows.

All u have to do is to create ure database with all tables, views,... with no data. Ship the empty database with ure application and when the user wants to create a new database u just copy the empty database to the user location.

HTH.

Hayder Marzouk

|||Thanks Hayder.

If there is a way to do this with a local sql database, I would appreciate some sample code to see how to do it.
|||

Hi,

You may create a T-SQL script and then run the script to create a database.

Move from C# express forum to Sql server forum.

Thanks

|||

Not within your specified 'requirements'

My preference is to not require the user to run an sql server on his machine to run my application.

A 'Local' sql database will require that the user run or have access to a SQL Server.

As Hayder mentioned, an Access database is an excellent option and does not require that the user have access to, or install a SQL Server.

No comments:

Post a Comment