0

I am working on a project using C# .net and I am connecting this project with SQL server database using (Data Source). Now, How can I submit my project to the professor? I tried to move the project folder to another computer, but I didn't work because of the database isn't connected.Now, I would like to know how to move my project to another computer then when you click on the execution file on that computer, it will work immediately.

He asked us to make a patch file, but I don't what that is.

3
  • 1
    You can use a SQLite or SQL CE DB to make it portable, or you can include the scripts necessary to create the DB and have him run it on his computer before running your code (assuming he's got some SQL Server installed). Here's a guide on what a patch file is. Commented Oct 30, 2013 at 20:16
  • 1
    SQL server has SQLCe which is the sql server version of SQLite. Commented Oct 30, 2013 at 20:18
  • I already created my databse using SqlServer Management System. Visual Studio I went to Tools >> Connect to Database. Then I added the DataSource. I am sorry for not understanding your explanation. What should I do with SQL CE? Commented Oct 30, 2013 at 21:31

3 Answers 3

2

Take a back up file of your database. How to do that is

1) Right Click your Database > Task > BackUp

2) It will open "Back Up Database Window"

 In Back Up Database Window 

 Check BackUp Component as "Database" RadioButton

 If you want to change the name , you can 

 Check Backup set will expire : as "After" RadioButton and select the value as 0

 Set Back Up To location as :

     C:\Program Files\Microsoft Sql Server\MSSQL10.MSSQLSERVER\MSSQL\Backup\YourDatabaeName.bak
 Click OK 

3) It will generate a "YourDatabaeName.bak" MSsql backup file for you. Which later your Teacher can import to another sql server

or 1) Right Click your Database > Task > BackUp > you can generate script and save it in a text file which you can give it as project material.

Regarding C# Application , you need to give the complete Project file includes starting from .sln file, all your project resource which are integrated with your app everything alongwith .sln should be inside a single folder and that must be your project folder.

What other you need ?

Sign up to request clarification or add additional context in comments.

6 Comments

Thank you so much for this great explanation My problem is when I moved the whole project file, it didn't work because of the database. My professor doesn't have SQL Server to send him my database !! Is there any way to attach the database with the project? with no need to have neither Visual Studio nor Sql Server Management System on my professor computer.
I really need your help
you can keep your database(.mdf and .ldf) inside App_Data folder if the APPLICATION is a asp.net web app. Then you need to change your <ConnectionStrings> section in web.config of your web app.
if your professor system doesn't have any of them (Visual Studio nor Sql Server Management System) then how he/she will test the app ? to run your app, to check your code depending upon the functional modules called as code review it needs these two softwares . please suggest your professor to keep him/her to be up to date according to the technology concern.
Dear Chandan Kumar, Thank you again for your reply. I am not using asp.net. I am using C# to make a desktop program. What should I write for example in the <connectionString> to make it works in any computer?
|
0

1) Place file of database in same Directory for yourApplication.exe

2) use this in concation:

SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + 
     System.IO.Path.GetDirectoryName(Application.ExecutablePath) + 
     "\\database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");

Comments

-1

you need to make an installer of the project ,so you can deploy your project on your professor's pc .but here is a catch. if your professor does not have the sql server then application will wont run. there are two possible ways you can handle it. 1. you have to buy a domain hosting ..so you host your database project.bak file on live server which is accessible over the internet you just need to change the connection string . 2. use sql-lite . by using this you only had to make a file of sql-lite database .then add this file to your installer you would be oky..cheers

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.