using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication2.App_Code
{
public class UserData
{
SqlConnection conn = null;
SqlCommand cmd = null;
public UserData()
{
conn = new SqlConnection("server=.;database=ODA;user=sa;pwd=123;");
cmd = conn.CreateCommand();
}
public bool have(string a, string b)
{
bool c = false;
cmd.CommandText = "select *from Users where Username=@a and Password=@b ";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@a", a);
cmd.Parameters.AddWithValue("@b", b);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
c = true;
}
conn.Close();
return c;
}
}
}