Skip to main content

idpass

 Server

using System.Data.OleDb;
public string check_login(string username,string pwd)
        {
            string sql;int row;
            OleDbConnection con = new OleDbConnection();
            con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\ASUS\\Documents\\Database5.accdb";
            con.Open();
            sql = "select count(*) from login where username='" + username +"' and pwd='" + pwd +"'";
            OleDbCommand cmd = new OleDbCommand(sql, con);
            row = (int)cmd.ExecuteScalar();
            con.Close();
            if (row > 0)
                return "Login successful.....";
            else
                return "username or password is invalid";
        }


Client

protected void Button1_Click(object sender, EventArgs e)
        {
            ServiceReference2.webser5SoapClient obj = new ServiceReference2.webser5SoapClient();
            string username = TextBox1.Text;
            string pwd = TextBox2.Text;

            string res = obj.check_login(username, pwd);

            Label3.Text = res;
        }

Comments