日期:2014-05-17 浏览次数:20531 次
public static DataSet ExecuteDataSet(CommandType commandType, string procedureName) { using (OleDbConnection connection = new OleDbConnection()) { connection.ConnectionString = ConnectionString; OleDbCommand command = new OleDbCommand(); command.CommandText = procedureName; command.CommandType = commandType; command.Connection = connection; connection.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter(); adapter.SelectCommand = command; DataSet dataSet = new DataSet(); adapter.Fill(dataSet); connection.Close(); connection.Dispose(); return dataSet; } }
public static DataSet ExecuteDataSet(CommandType commandType, string procedureName) { using (SqlConnection connection = new SqlConnection()) { connection.ConnectionString = ConnectionString; SqlCommand command = new SqlCommand (); command.CommandText = procedureName; command.CommandType = commandType; command.Connection = connection; connection.Open(); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = command; DataSet dataSet = new DataSet(); adapter.Fill(dataSet); connection.Close(); connection.Dispose(); return dataSet; } }
------解决方案--------------------
基本是ole的换成sql 开头的
http://www.cnblogs.com/icedog/archive/2010/08/12/1798495.html
------解决方案--------------------
OleDbConnection 改 SqlDBConnection
------解决方案--------------------
using system.data.sqlclient...