34 lines
910 B
C#
34 lines
910 B
C#
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
using MySql.Data.MySqlClient;
|
|
|
|
namespace BeWo.Data.Access
|
|
{
|
|
public class AdoDAO : AbstractBaseDAO
|
|
{
|
|
public DataSet ExecuteQuery(string pQuery)
|
|
{
|
|
DataSet lDs = new DataSet();
|
|
if (!string.IsNullOrEmpty(pQuery))
|
|
{
|
|
using (var lCommand = this.Session.Connection.CreateCommand())
|
|
{
|
|
lCommand.CommandText = pQuery;
|
|
|
|
|
|
|
|
IDataAdapter lAdapter = lCommand is SqlCommand
|
|
? new SqlDataAdapter { SelectCommand = (SqlCommand)lCommand }
|
|
: (IDataAdapter)
|
|
new MySqlDataAdapter { SelectCommand = (MySqlCommand)lCommand };
|
|
|
|
lAdapter.Fill(lDs);
|
|
}
|
|
}
|
|
|
|
|
|
return lDs;
|
|
}
|
|
}
|
|
} |