C# & SQL Server: move array directly into SQL Server -
is somehow possible move 2 dimensional array directly database (sql server) without transforming sql statement?
i know there kind of direct connection in vb6.0, can not remember how done then, nor if still possible.
in vb6, avoid explicit insert statements creating recordset, inserting rows , calling .update. "direct connection" if command mode adcmdtabledirect.
in ado.net, can so, there many ways, such linq sql or entity framework. if want plain low-level vanilla vb6-like style, that'd dataadapter.update method.
using (system.data.sqlclient.sqlconnection c = new system.data.sqlclient.sqlconnection("data source=...")) { using (system.data.sqlclient.sqldataadapter = new system.data.sqlclient.sqldataadapter("select * atable;", c)) { using (system.data.sqlclient.sqlcommandbuilder b = new system.data.sqlclient.sqlcommandbuilder(a)) { using (datatable t = new datatable("atable")) { a.fillschema(t, schematype.source); t.rows.add(1, "foo"); t.rows.add(2, "bar"); a.update(t); } } } }
Comments
Post a Comment