Advertisement
daegron

dao5

Nov 25th, 2022
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. public class UserDao
  2. {
  3.     public User findById(int id)
  4.     {
  5.         using var dataSource = NpgsqlDataSource.Create(
  6.             "Server=mydemoserver.postgres.database.azure.com;" +
  7.             "Username=mylogin@mydemoserver;" +
  8.             "Database=mypgsqldb;" +
  9.             "Port=5432;" +
  10.             "Password=<server_admin_password>");
  11.         var command = dataSource.CreateCommand("SELECT * FROM USER_TABLE WHERE ID = {id}");
  12.         // execute command etc.
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement