private void ConnectionDataBase() //连接数据库。
{
// 创建ole连接,其中使用web.config作数据连接配置。
ConStr = ConfigurationSettings.AppSettings["ConnectionString"];
con = new OleDbConnection(ConStr);
//登录验证
public bool Longin(string UserAccount,string UserPassWord)
{
string QryStr;
object Count;
QryStr = "SELECT COUNT(*) FROM XTGL001 ";
QryStr = QryStr +" WHERE XTGL001001='"+UserAccount+"' ";
QryStr = QryStr +" AND XTGL001002 = '"+UserPassWord+"' ";
ConnectionDataBase();
OleDbCommand myCommand = new OleDbCommand(QryStr,con);
// Mark the Command as a Text
myCommand.CommandType = CommandType.Text;
con.Open();
Count= myCommand.ExecuteScalar();
...}