I'm working on a Windows Forms application in VS 2013 that requires saving data. I can't find a good solution for this, since:
A SQL Server database will work fine, but it will force the user
to have SQL Server installed on their computer.
The same applies to Access or Oracle DB.
DataSets require a database connection,which leads me to 1) and 3).
Text/XML files don't satisfy the
security requirements and will seem like a very primitive solution.
So , in essence, when the user installs the application, on its
first deployment it must create a database and keep it for future
access, without requiring the user to have any special programs
installed (e.g. SQL Server). I apologize if this question seems
stupid.
This is in two parts - how to create a database application and how to access it for initialisation.
Option 1 - if you can resolve the problem of installing SQL Lite/compact using the suggestions above then you can use Entity Framework with code first to create the database and tables. There are plenty of examples only a Google search away.
Option 2 - create an Access database (an MDB or ACCDB file) with blank/empty tables and deploy this as part of your application. You can the access this with a suitable connection string - again, Google will solve that one.
Use SQL Compact Edition .
Using LINQ to SQL you can create a Database/Tables for the first time deployment.
Please Refer the Link http://msdn.microsoft.com/en-us/library/bb399420(v=vs.110).aspx
Related
I'm pretty new to developing in Visual studio and working on databases.
I am working on a program that deals with reading and writing data to a database that I created with Visual studio.
I need to work on this project from another computer and copying over the project files was a breeze but I'm facing issues when it came to copying the .mdf database file.
Upon research it seems like, at least in the Microsoft SQL Server program, that I would have to "Detach" the database before copying it over to a different computer. So I am assuming I would have to do something similar with my Visual Studio Database as well.
Anyone has any inputs with regards to this?
If there is not much that I can do, I guess I could recreate all my tables and everything in Microsoft SQL Server program, so that it would be easier to move the database if needed.
I was in a similar situation such as yourself when I began developing my first core application. You have a few different options including:
Detach an already created database from the hosted SQL Server service and "re-attach" to another SQL Server service that is accessible from the desired set of hosts. You have to essentially disconnect the database from the service before you are able to transfer or migrate it since the process will have an exclusive lock on the .mdf file. https://msdn.microsoft.com/en-us/library/ms190794.aspx
Create the necessary .sql scripts to construct the database and run in the appropriate order e.g. create database, create tables, etc. to re-construct the database at the service location.The neat thing about this technique is if you have already created the database (which it sounds like you have) SQL Server allows you to generate scripts rather than having to write them yourself. https://technet.microsoft.com/en-us/library/ms178078(v=sql.105).aspx
Finally you may use a subscription based service such as SQL Server through Azure to host the service for controlled global access aka DBaaS (Database as a Service). I can't post anymore links, but look at Microsoft's Azure SQL Server hosting service if you are curious about this option.
The unfortunate part you have to decide is how much time you would like to invest in this. I began developing the application from scratch which led me to developing scripts to conjure up the database for deployment purposes. Good luck!
I need your help to answer a question.
I coded a basic c# portable exe application that uses an Access Database on a server computer. On the network there are some client computers that runs this application and retrieve and store data via this database placed on the server computer in a shared folder. Every client coputer can access my database with this connection string:
#"Provider=Microsoft.ACE.OLEDB.12.0;Data Source =\\ANKFILESERVER1\aractakip\DatabaseAd.accdb
So far, there has been no problem. But as known, Access (Oledb) database has a limited capacity to save datas and since i'm worrying that someone change or delete my database files -authenticated for everyone- i decieded to use another database platform like postgresql.
My question is, if i install postgresql on the server computer and migrate my database tables, Are every client computers needed to install postgresql to access my database tables? If yes, what should be my connection string?
Thanks in advance.
You will need a client driver - like psqlODBC - installed on each computer that connects to PostgreSQL via MS Access, yes.
You can install psqlODBC separately, or using the main PostgreSQL installer. The separate psqlODBC-only installer is an msi that can be deployed over Active Directory, making management easier.
The connection options are covered in the psqlODBC documentation.
Microsoft Access is really written for the Microsoft JET / OLEDB engine, and to communicate with Microsoft SQL Server. It works with PostgreSQL, but it doesn't fully "understand" all PostgreSQL's features. It also does some things in totally non-SQL-standard ways that work on MS SQL but do not work on PostgreSQL. So it can be awkward to use MS Access with PostgreSQL due to things like Access not really supporting SEQUENCEs properly. Note, though, that I haven't used Access since Office 2008, so things may have improved.
I have developed C# and SQL Server Express database project. Can I secure from copying and pasting my .mdf file? Is there any way to protect my .mdf file from being watched the schema? So no one could see the functions and tables of my database? No detaching or attaching it to other instances? Do you have any ideas how to do or any ready mechanism?
I used DbDefence in my project. I am satisfied with security now. It has one minus - free version allows only encrypt 77Mb, which is eniugh in my project. If you want to more, you can purchase commercial one. Very easy to install and to use.
You can find more information here http://www.dbdefence.com/index.php
If you need any help, please contact me.
Take a look at my question at: deploy SQL Server Database with a Winforms app.
I ended up using SQL Server CE and I'm perfectly happy with it. No SQL Server installation needed (just a couple of additional dlls). And you can set password for your database as well. If you're using Winforms, there are a couple of glitches. But workarounds for each one can be found with a simple googling.
I'm hoping someone can help me. I recently started the development of a windows form application connecting to a remote sql server database. I was happy enough developing it until a potential client queried if they would be able to buy the whole application but they do not want the application connecting to the db via the internet.
I predominantly develop websites using php/mysql but migrated to c# for this particular project. I'm familiar with sql but not sure what database I should be using if the client wishes to have the whole application on their own computer. I've considered providing the database install as a pre-requisite when publishing the app (although I'm currently not sure how to do that) but I'm having reservations whether that is suitable or could lead to more problems. I want to create an application that can install to a single computer and has little to no need for administration. Could someone advise the best way to approach the data storage in this instance.
Because you have already a SqlServer database operating on your remote site, the best path should be to use the LocalDB version of SqlServer Express 2012. See this link about deployment.
If you don't use stored procedures, views and triggers then also the SQL CE could be an option, but you will not have file binary compatibility and you should work on importing your schema and data.
SQL CE is a compact light weight way of going..
http://blogs.msdn.com/b/sqlservercompact/archive/2011/01/12/microsoft-sql-server-compact-4-0-is-available-for-download.aspx
I have created a new MVC3 project and used the ADO.NET Entity Data Model to map out my existing database. It worked great.
Now, that is a database I don't want to affect when doing development of my web app, so I was looking to now attach that data model to a local database (haven't selected one yet, suggestions welcome. I was thinking SQL Server CE or MySQL).
Does anyone have any ideas on how to do this? I'd be nice to keep the existing connection string to my live database as well as this development database environment.
You can generate another matching DB using whatever technology you want (though it would be good to keep them similar to your production DB) and then have a Web.Debug and a Web.Release setup.
If you look at swapping out the configuration, connection string portion of your web.config file you can easily swap from development to production.
http://msdn.microsoft.com/en-us/library/dd465326.aspx
This provides the relevant information for the transform statements in your Web.config file, but from the sounds of it you can simply swap the connection portion of your web.config and get what you want.
Is the existing database on your machine, or on a server somewhere?
If it's on your machine, just back it up and restore it to a different database; i.e. if your database is called XYZ, back it up and restore it to a database called XYZ-Testing. You can then connect to and use XYZ-testing without affecting XYZ.
If the existing database is on a server somewhere, the easiest solution is to install SQL Express on your machine, and then backup the database on the server and restore it on your machine.
Doing this will make your life much easier than trying to use a different database type (SQL CE or MySQL).
Another option would be to use SQL Server Data Tools (SSDT) free download, add-in to VS or stand-alone if no VS, and then to create a local database project for development. I wrote a blog post about using SSDT as well.