Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Data;
- using System.Data.SqlClient;
- /// <summary>
- /// Summary description for Class2
- /// </summary>
- public class Class2
- {
- SqlConnection con = new SqlConnection("@Data Source=F766DTRV;Initial Catalog=hello;User ID=sa;Password=Admin@123");
- public string login(string uname, string pass)
- {
- con.Open();
- SqlDataAdapter ad = new SqlDataAdapter("select * from users where username='" + uname + "'and pass='" + pass + "'", con);
- SqlDataAdapter ad1 = new SqlDataAdapter("select * from admin where username='" + uname + "' and pass='" + pass + "'", con);
- DataSet ds = new DataSet();
- DataSet ds1 = new DataSet();
- ad.Fill(ds);
- ad1.Fill(ds1);
- con.Close();
- string y = "null";
- if (ds.Tables[0].Rows.Count > 0)
- {
- y = "user";
- }
- else if (ds1.Tables[0].Rows.Count > 0)
- {
- y = "admin";
- }
- return y;
- }
- }
Add Comment
Please, Sign In to add comment