using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
namespace xxxx
{
public class SQLMgr
{
public SqlConnection mConnection;
public SQLMgr()
{
try
{
if (Properties.Settings.Default.Prod)
{
mConnection = new SqlConnection(Properties.Settings.Default.ConnProd);
}
{
mConnection = new SqlConnection(Properties.Settings.Default.ConnTest);
}
if (mConnection.State != ConnectionState.Open)
{
mConnection.Open();
}
}
catch (Exception Ex)
{
throw Ex;
}
}
public bool CheckIfXXX(int iXXX)
{
bool bRC = false;
try
{
string sSQL = string.Empty;
if (mConnection.State != ConnectionState.Open)
{
mConnection.Open();
}
sSQL = "xxxx where yyy = " + zzz;
using (SqlCommand sqlCmd = new SqlCommand(sSQL, mConnection))
{
using (SqlDataReader myReader = sqlCmd.ExecuteReader())
{
if (myReader.HasRows)
{
bRC = true;
}
}
}
}
catch (Exception Ex)
{
throw Ex;
}
return bRC;
}
}
}
No comments:
Post a Comment