I have the code below, adapted from a book, in Sub New() of a form. It's used to populate some textboxes, and works fine (so far). The eventual aim is to have Next and Previous buttons to navigate the dataset.
But I don't see where the connection is ever closed. I'd rather have the dataset retrieve records, close the connection and re-open it for each separate click event. There could be upwards of 20 users at one time, so I don't want a permanent connection.
Should the code be in a stand alone sub, use a static variable, or what? Thanks.
Last edited by salvelinus; Dec 19th, 2003 at 03:28 PM.
Wouldn't you just use an ADO.NET disconnected dataset? That way you would open the connection, fill the dataset, close the connection, and not reopen it until you need to refresh the date (or save changes, if that's a possibility).