VB.net DataGridView run time Data Source
Posted on 2011-03-09
Normally I create a DataGridView by first creating a datasource using a table or tables or a view in SQL, then I drag and drop the data source onto the dgv control.
In this case, though, I need to see if it is possible to use one dgv control, but change the data source at run time. The purpose of the dgv will be to display the results of a select query with a WHERE clause that uses a parameter for an order number. The VB needs to launch the query and pass in the parameter.
I can do all of that, but multiple people at different workstations will be using the dgv at the same time and passing in different parameters, so I can't just populate the datasource table with the results of the query because of the need for simultaneous access.
Is there a way that I can just run the query at the workstation and use the results of the query as the datasource for the dgv on that computer? Or, I can send the results of the query to a unique table name for each individual user, but I still need a way to change the datasource at each computer to identify the unique table. Can this be done?