Guest User

Untitled

a guest
Aug 14th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Data;
  6. using System.Data.SqlClient;
  7.  
  8. /// <summary>
  9. /// Summary description for Class2
  10. /// </summary>
  11. public class Class2
  12. {
  13. SqlConnection con = new SqlConnection("@Data Source=F766DTRV;Initial Catalog=hello;User ID=sa;Password=Admin@123");
  14. public string login(string uname, string pass)
  15. {
  16. con.Open();
  17. SqlDataAdapter ad = new SqlDataAdapter("select * from users where username='" + uname + "'and pass='" + pass + "'", con);
  18. SqlDataAdapter ad1 = new SqlDataAdapter("select * from admin where username='" + uname + "' and pass='" + pass + "'", con);
  19. DataSet ds = new DataSet();
  20. DataSet ds1 = new DataSet();
  21. ad.Fill(ds);
  22. ad1.Fill(ds1);
  23. con.Close();
  24. string y = "null";
  25.  
  26.  
  27. if (ds.Tables[0].Rows.Count > 0)
  28. {
  29. y = "user";
  30. }
  31. else if (ds1.Tables[0].Rows.Count > 0)
  32. {
  33. y = "admin";
  34. }
  35. return y;
  36.  
  37. }
  38. }
Add Comment
Please, Sign In to add comment