public TransactionForm() { InitializeComponent(); con = new SqlConnection(); con.ConnectionString = "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=SQLdatabase;Integrated Security=True;Connect" + " Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"; dbc = new DBconnector(); //get the first index int first = dbc.getFirstId("Transaction"); //get the first transaction tr = getTransactionFromDB(first); nId.Value = first; //get all transactions updateList(); //show the first transaction fillForm(); }