Is there any API available similar to JDBC batch update [PreparedStatement.addBatch() and PreparedStatement.executeBatch() ]?
I have seen the DataAdapter. However I think it is using DataTable; is it similar to JDBC PreparedStatement?
Is there any API available similar to JDBC batch update [PreparedStatement.addBatch() and PreparedStatement.executeBatch() ]?
I have seen the DataAdapter. However I think it is using DataTable; is it similar to JDBC PreparedStatement?
PreparedStatements in JDBC are directly analogous to SqlCommand, right down to supplying the statement and parameters. Here's an example:
var cmd = "UPDATE SomeTable SET Value = @Param1 WHERE ID = @ID";
using (var connection = new SqlConnection("Connection String Here"))
using (var command = new SqlCommand(cmd, connection))
{
command.Parameters.AddWithValue("@Param1", "NewValue");
command.Parameters.AddWithValue("@ID", 1);
connection.Open();
command.ExecuteNonQuery();
}
From what I've read, all the above should see very familiar for someone who uses PreparedStatement.