Execute 2 large SQL scripts from C# Web Form

Completed Posted Apr 18, 2009 Paid on delivery
Completed Paid on delivery

Hello,

I am witting an ecommerce application. during the setup process I need to execute two SQL scripts to a SQL 2005 or 2008 server.

The script work fine I have tested them many times, however executing them via C# gives me a few errors.

Your task is to modify the code snippet **below** so the SQL script will execute without problems.

1. You **cannot** modify the sql scripts, leave them as they are.

2. SQL scripts are **attached** in the zip file

3. **Below** is the code I currently use, please use this as a base.

4. Your code must handle any find/replace and/or formatting requirements.

5. Test this thoroughly on your side, do not send me buggy code

6. **If you** can do anything special or **have any other recommendations** **mention that in your bid**. I always read these.

I posted this on experts exchange and got some tips, see:

[url removed, login to view]

## Deliverables

public static bool ExecuteSQLScript(string Host, string Database, string User, string Password, string SqlScript)

{

// Test DB

string host = [url removed, login to view](Host);

string db = [url removed, login to view](Database);

string user = [url removed, login to view](User);

string pass = [url removed, login to view](Password);

//Create and Open Connection

SqlConnection conn = new SqlConnection();

if (![url removed, login to view](pass))

conn = new SqlConnection([url removed, login to view]("Data Source={0};UID={1}; PWD={2}; Initial Catalog={3};", host, user, pass, db));

else

conn = new SqlConnection([url removed, login to view]("Server={0};Database={1};Trusted_Connection=yes;", host, db));

bool worked = false;

string count = [url removed, login to view];

SqlCommand cmd = new SqlCommand(SqlScript, conn);

SqlScript = [url removed, login to view]("GO", ""); // does this help??

try

{

[url removed, login to view]();

[url removed, login to view]();

worked = true;

}

catch

{

worked = false;

}

finally

{

[url removed, login to view]();

}

return worked;

}

.NET ASP C Programming C# Programming Engineering MySQL PHP Project Management Software Architecture Software Testing SQL Visual Basic

Project ID: #3818699

About the project

3 proposals Remote project Active Apr 18, 2009

Awarded to:

hwanghendra

See private message.

$15 USD in 5 days
(453 Reviews)
6.9

3 freelancers are bidding on average $15 for this job

powerincvw

See private message.

$15.3 USD in 5 days
(17 Reviews)
3.2
khatyanvw

See private message.

$15.3 USD in 5 days
(4 Reviews)
0.3