Files
BeWoPlaner/Data/Access/AdoDAO.cs

34 lines
910 B
C#
Raw Normal View History

2016-06-27 01:45:38 +02:00
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))
{
2017-02-01 13:53:59 +01:00
using (var lCommand = this.Session.Connection.CreateCommand())
{
lCommand.CommandText = pQuery;
2016-06-27 01:45:38 +02:00
2017-02-01 13:53:59 +01:00
IDataAdapter lAdapter = lCommand is SqlCommand
? new SqlDataAdapter { SelectCommand = (SqlCommand)lCommand }
: (IDataAdapter)
new MySqlDataAdapter { SelectCommand = (MySqlCommand)lCommand };
2016-06-27 01:45:38 +02:00
2017-02-01 13:53:59 +01:00
lAdapter.Fill(lDs);
}
2016-06-27 01:45:38 +02:00
}
2017-02-01 13:53:59 +01:00
2016-06-27 01:45:38 +02:00
return lDs;
}
}
}