Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Export(string sql)
- {
- //Server - the host of the sql server
- //Database - an intial catalog/database on which it should do the queries. if needed change it to your database name
- //Port - the port of the sql server, it might not be needed always.
- var Driver = new NHibernate.Driver.MySqlDataDriver();
- var conn = Driver.CreateConnection();
- conn.ConnectionString =
- "Server=" + Host +
- ";Database=mysql" +
- ";Username='" + Username +
- "';Password='" + Password +
- "';Port=" + Port + ";";
- conn.Open();
- var command = Driver.CreateCommand();
- command.CommandText = sql;
- command.Connection = conn;
- command.ExecuteNonQuery();
- command.Dispose();
- conn.Close();
- conn.Dispose();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement