Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. string con = "Data Source=xxx.database.windows.net;User id=xxx;password=xxx;Database=Playvoice;encrypt=true;";
  2. private SqlConnection sqlConnection;
  3.  
  4. try {
  5. SqlCommand sqlCommand;
  6. string sql = "UPDATE last_login SET date=getdate(), ip=@param1 WHERE id_user=@param2";
  7. sqlCommand = new SqlCommand(sql, sqlConnection);
  8.  
  9.  
  10. sqlCommand.Parameters.AddWithValue("@param1", GetIPAddress());
  11. sqlCommand.Parameters.AddWithValue("@param2", auth.eid);
  12.  
  13. sqlCommand.Connection = sqlConnection;
  14.  
  15. sqlConnection.Open();
  16. sqlCommand.ExecuteNonQuery();
  17. sqlConnection.Close();
  18.  
  19.  
  20. }
  21.  
  22. catch (Exception ex)
  23. {
  24. MessageBox.Show("Blad z polaczeniem SQL");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement