Running database scripts in C #

How to run database scripts (mysql db scripts) in C #.

Thanks, sirni.

+1
source share
4 answers

Run the child process and execute the command line client mysqlusing the script input.

The puzzle is to try to read the script as a file and execute the SQL commands inside it one by one, but there are many statements in the SQL script that cannot be executed this way.

Thus, you will need to duplicate the mysql client code anyway in order to run the SQL script. Do yourself a favor and use a program that is already designed for this purpose.

0
source

, ExecuteNonQuery ( - ) Execute.... CommandText script .

: http://database-programming.suite101.com/article.cfm/how_to_add_records_to_mysql_with_c

+1

All Articles