How to make secure local SQL database for C# application - c#

I have a C# application with .NET 3.5 and SQL SERVER 2008 R2.
I want to make a setup project and i want to install each user db while installation.
I use local db when i import database as application file, the database is available and anyone who has access to the laptop os has access to the database. because the local db' s are not for the multiuser scenarios.
how to secure the database file' s from access or being modified? it contains sensitive data for application behave.

Create in sql windows authentication to server authentication
then you can add username and password then you can secure your database

Related

Do I have to install sql server on each client to use my disk top application?

I have a disk top application made by c# visual studio. My question is do I have to setup SQL server on each client to use my application? or there is another way to attach my database with my application and compress it as one and send to each client and those just extract that file and use the application correctly?
On a real scenario, your database should be placed on a remote server and the clients should only access the database through your API (that will need to support authentication or any other identity based systems).
If your application only needs to store some local information (relevant only for your client app), then you can just use LocalDB or AppSettings, depending on your data structure.
Otherwise, if your application contains more complex features, then you will need an API and a remote DB managed only by you.
To conclude, you only need to setup Sql Server once, when you want to create the design of it (tables, columns, links). The clients will only have to connect to it and pull their data. And this task can be done without installing SqlServer. This link shows you that you only need System. Data assembly to connect to a Sql Server DB.
Yes you need to instal SQL server on each machine or if you go for LocalDB then also u need to instal SQL server engine ,and you have a better option u need to buy sqlserver from AZURE (it's free for one month try if want click here AZURE)

C# SQL Server: Application works with database from another pc

I have my application written in C#, it uses a SQL Server database. I have a connection to a database in my C# code, some queries to write/read from database.
Now consider following: if I want to run this app from another PC, this PC has no SQL Server, will this app work? (I assume not) If not then how can this another PC still work with database? Is there a way to programmatically create database on another PC using C# so it has a name I need, columns I need. I created my database using SQL Server Management Studio.
I guess your application works with a local server.
First of all you should check in your application at startup if there is any local mssql server running. If not, you should handle it by installing one programmatically.
Read this answer how to do this if you don't know it.
After that you have to create the database, it's tables, maybe adding user priviliges. Write a SQL script that gets started by a class that starts it.
Read this to see how to start a SQL script in C#
You can do this by setting up SQL server on another machine (server).
Set that servers authentication to SQL Server authentication (requires username and password for that SQL server Management Studio)
Change the connection string in web/App.config from your C# app to use that servers Ip address and Credentails for SQL server

Simple security for SQL Server LocalDB for local Windows application

A simple C# windows form application that uses a local SQL Server LocalDB (.mdf).
I want the end user to install the SQL LocalDB and application and run it in that simple, but also want the DB to be secured with a password (Like the one that is used on SQL Compact (sdf)).
I couldn't find that option in (mdf DBs) without creating a login in the server that should be identical to the one in the connection string! Which is not user friendly!
Need help! thanks :)

Database to use when creating an installer for your c# application

I am creating a c# application which requires to use a database and i am also planning to create an installer for my application. I just want to ask which database would be best to use in my application and how do i install it on a user machine while installing my application through installer file.
I have thought of using MYSQL database but for that u need to have MYSQL installed.
Update
i want each user to have there own instance of database when they install the application
You do not have to ship a full database server with your application; only the redistributable runtime which your application would use to connect to the actual database server remotely. In the case of MySQL, you only need the assemblies.
Applications I wrote relied heavily on SQL Server. In order to simplify evaluations and the initial deployment, the installer would install SQL Server Express (installed as an application specific instance). This is an approach I'd recommend if your application is intended to a centralised database.
What is key to understand, especially with commercial application, is that the database engine you install may have to co-exist with existing versions of the respective database engine. That is why application specific instances was created for SQL Server Express.
The alternatives, which are embedded, are:
SQLite.net
SQL Server Compact Edition. The deployment process is well defined.
VistaDB
Embedded databases have some challenges when deployed as part of a server application. For many years, Microsoft refused to allow SQL Server Compact Edition to be used for ASP.NET applications. If the database is per user, per device, an embedded database may be perfect.
Also be aware that MySQL has license restrictions when shipped as part of commercial software (aka you're acting as an OEM, ISV or VAR).
Have a look at SQL Server Express Edition.
It's just a file which you can copy and a class library which allows to access it. And after you finished your installation you can just delete the files (or to keep them if you need them to uninstall the product).
may be u are a fresh.
MYSQL is ok ,but u are creating a C# application,i strongly advise you use mssql
because C# has a close relationship with mssql,develop more convenient.
My advice would be using SQL Azure.
But only if:
You don't need much storage (<1GB).
You don't save sensitive Data there.
Your users have an internet connection.
It's a cloud based Sql Server Database. And the Conneciton is very simple, basically you connect like to any other Database via the Connection String.
www.windowsazure.com

application with setup file with out SQL Server database

I have a windows application which is uses SQL Server as its database. For this application I want to create a setup file for other desktops, but I don't want to install SQL Server on each and every client.
Can you please suggest how to create Windows application with local storage setup file without installing any databases or framework libraries?
You can use SQL Server Compact. The database is stored in a file that you carry with the product rather than requiring a database server.
If this is just for "settings" then consider storing it in the user's application data as a simple XML file.
You don't need to install SQL Server on each client - you can simply install it on a central server then all the clients can connect to and use the same instance.
If this is not a good option because each client must have its own storage locally then you can look to use something like SQL Server Compact, which is a very cut down version of SQL Server that doesn't require installation and runs inproc.

Categories