sql server - Is a Data Adapter always needed? -


if have query want execute, , have no need fill data within table, necessary have data adapter purpose?

no not necessary use sqldataadapter. bridge between dataset , sql server.

instead can use sqlcommand - executenonquery.

you can use executenonquery perform catalog operations (for example, querying structure of database or creating database objects such tables), or change data in database without using dataset executing update, insert, or delete statements. although executenonquery returns no rows, output parameters or return values mapped parameters populated data.

using (sqlconnection conn = new sqlconnection(            "your connection string")) {       using (sqlcommand command = new sqlcommand("your sql", conn)       {         conn.open();         command.executenonquery();       } } 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -