Advertisement
Guest User

Untitled

a guest
Mar 6th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. void FillLogins(string userName, string password)
  2. // Open connection
  3. using (SqlConnection c = new SqlConnection(yourConnectionString))
  4. {
  5. c.Open();
  6. // Create new DataAdapter / Command
  7. using (SqlDataAdapter a = new SqlDataAdapter(
  8. "Select Count (*) From dbo.[LOGIN] where Username= @userName AND Password = @password", c))
  9. {
  10. a.SelectCommand.Parameters.AddWithValue("@userName", userName);
  11. a.SelectCommand.Parameters.AddWithValue("@password", password);
  12. // Use DataAdapter to fill DataTable
  13. DataTable t = new DataTable();
  14. a.Fill(t);
  15. }
  16. }
  17. }
  18.  
  19. FillLogins(USERNAME_txt.Text, password_txt.Text);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement