日期:2014-05-16 浏览次数:20933 次
using (System.Data.Odbc.OdbcConnection cnn = new System.Data.Odbc.OdbcConnection()) { cnn.ConnectionString = "...";//连接字符串没问题,这里省略 cnn.Open(); System.Data.Odbc.OdbcCommand command = cnn.CreateCommand(); command.CommandText = "DELIMITER |"; command.ExecuteNonQuery(); }
using System; using MySql.Data.MySqlClient; using System.Data; using System.Data.OracleClient; using System.Globalization; using System.Collections; ..... static void Main(string[] args) { string sMySQLConnStr = "Database='csdn';Data Source='localhost';User Id='root';Password='123'"; MySqlConnection mysqlCnn = new MySqlConnection(sMySQLConnStr); mysqlCnn.Open(); MySqlCommand cmd = new MySqlCommand("DROP PROCEDURE IF EXISTS sp_test;create procedure sp_test() begin select 1; end ;", mysqlCnn); cmd.ExecuteNonQuery(); }