Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. ConexionController con = new ConexionController();
  2. cTripleDES decry = new cTripleDES();
  3. SqlConnection miConexion =new SqlConnection( "data source = snare.arvixe.com; initial catalog=logins; user id=usrLogins; password=Madera@2015");
  4. public int Login(string user, string password)
  5. {
  6. try
  7. {
  8. if (miConexion.State == ConnectionState.Closed)
  9. {
  10. miConexion.Open();
  11. }
  12. SqlCommand comando = new SqlCommand("select email, clave from CrmCustomers where email = '" + user + "'and clave = '" + password + "' ", miConexion);
  13. comando.ExecuteNonQuery();
  14. DataSet ds = new DataSet();
  15. SqlDataAdapter da = new SqlDataAdapter(comando);
  16. da.Fill(ds, "CrmCustomers");
  17. DataRow DR;
  18. DR = ds.Tables["CrmCustomers"].Rows[0];
  19. if ((user == DR["email"].ToString()) && (password == DR["clave"].ToString()))
  20. {
  21. miConexion.Close();
  22. return 1;
  23. }
  24. else
  25. {
  26. miConexion.Close();
  27. return 2;
  28. }
  29.  
  30. }
  31. catch (Exception ex)
  32. {
  33. miConexion.Close();
  34. return 3;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement