I want to deploy a database application in C#. I should write a script for creating a database and its tables.
The script should work only at install time and setup the database automatically. Or tell me if there is another better way to do that.
Actually I wanted to deploy this application on another PC. but connection string and login permissions to the database are causing problem.
What I have tried is:
1. Created a database using SQL management studio.
2. copied database file to Client PC.
But that did not work.
Then I tried adding a new database project to my solution. That also did not work.
The application runs fine on my own PC where I have developed this project.
Edited 1 Year Ago by blueshiftdani: I wanted to add more details
If this is SQL Server then there are a number of options. One would be to generate a script from SQL Server Management Studio. You would have to do this in a number of steps:
An alternative would be to use SMO (SQL Server Management Objects) which is a powerful library that allows you to pretty much fully manage SQL Server. With this, you could either execute scripts or more aptly, restore a backup of your database (that you might include in your installation package) to the target SQL Server. In fact, this might be the easiest option. There is an example of backing up and restoring using SMO on MSDN.
Or tell me if there is another better way to do that.
If you go with the SMO route, you could have some code that runs on startup of your application that determines if you have a connection string (i.e. the process has already been run) and if not, present the user with a dialog whereby they can choose the SQL Server instance (available via SMO) and provide credentials. Upon successful connnection, save these details to a configuration file for later use. Then run the script or restore the database. The next time the program is run, you will have a connection string and therefore this setup piece will not need to be executed.
I am developing a simple job card creator application with VB.net 2012, using Access 2010 as database.
The code I have generated to write data from a datagridview to the database table is successfully saving the data, but with an error "Parameter @name has no default value". The ...
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...