I need to (at runtime) build some SQL statements to update a database that I am NOT connected to. Right now I am using a String.Format to build the query, but it's difficult to deal with all the different parameter cases (different datatypes, null, values, escaping, etc..).
What I'd like is to use CommandBuilder--but CommandBuilder requires a DataAdapter which requires a connection and I'm not connected to my database (this is a stand alone utility).
Is there a way to use CommandBuilder in a disconnected state or how can I build this well formatted SQL query in a way that will require me to write a minimal amount of code?
(Target DB is SQL Server)
Is there a way to use CommandBuilder in a disconnected state?
Unfortunately NO.
SqlCommandBuilder is designed to work with a SqlDataAdapter and a SqlCommand object, or just a SqlCommand, and from the documenttation it needs to connect to the database to retrieve information shema.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With