Is it possible to modify the SELECT, UPDATE, DELETE, and INSERT commands for a tableadapter at runtime? What I want to do is set the commands for the tableadapter based on the connection type (SQL Server or Access) the user selects when the application opens.
Basically, I want the tableadapter names to remain the same so I don't have to put if statements in everywhere I call tableadapter.fill or .update methods. Instead, I want to put an if statement in after the connection string is chosen and modify the SELECT, UPDATE, DELETE, and INSERT commands based on what the user selects. Something like below
If ConnectionString = Access Then
tableadapter.selectcommand="SELECT...FROM AccessDbase"
Else
tableadapter.selectcommand="SELECT...FROM SQLDbase"
End if
What is the best way to do this without having to create two separate applications (one to connect to Access and on for SQL Server)?
Many thanks in advance.