public string SQLCalistir_S_Oled(string cumle, string ConnStr, List<OleDbParameter> parameters)
{
using (OleDbConnection conn = new OleDbConnection(ConfigurationManager.ConnectionStrings[ConnStr].ConnectionString))
{
using (OleDbCommand comm = new OleDbCommand(cumle, conn))
{
try
{
if (parameters != null)
{
foreach (OleDbParameter parm in parameters)
{
comm.Parameters.Add(parm);
}
}
conn.Open();
return comm.ExecuteScalar().ToString();
}
catch (Exception ex)
{
return "";
}
}
}
}
public string SQLCalistir_S(string cumle,string ConnStr, List<SqlParameter> parameters)
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[ConnStr].ConnectionString))
{
using (SqlCommand comm = new SqlCommand(cumle, conn))
{
try
{
if (parameters != null)
{
foreach (SqlParameter parm in parameters)
{
comm.Parameters.Add(parm);
}
}
conn.Open();
return comm.ExecuteScalar().ToString();
}
catch (Exception ex)
{
return "";
}
}
}
}
------------------------------------------------------------
List<OleDbParameter> p = new List<OleDbParameter>();
p.Add(new OleDbParameter("p1", txt_plasiyerkodu.Text));
p.Add(new OleDbParameter("p2", txt_sifre.Text));
string pk= SQLCalistir_S_Oled(@"SELECT TOP 1 PLASIYER_KODU FROM [PERSONELLER] WHERE PLASIYER_KODU=? and SIFRE=? AND CIHAZKODU LIKE '%" + txt_cihazkodu.Text + "%'","ConnStr", p);