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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.