On Jun 11, 8:23 pm, z...@construction-imaging.com wrote:
On Jun 11, 11:20 am, r...@lucent.com (Robert McCabe) wrote:
How do I have to code the execution of such an INSERT or UPDATE SQL statement ?
Given the follwoing code:
command = connection.CreateCommand();
command.CommandText = "INSERT ....";
A SELECT statement would continue with:
OracleDataReader rdr;
rdr = commnad.ExecuteReader();
But this doesn't work for INSERT and UPDATE commands.
How should I proceed in this case ?
Robert
You just asked the same question someone asked just before you, and
was answered.- Hide quoted text -
- Show quoted text -
Try this:
private void InsertRecord(string nonQuery)
{
SqlConnection connectionObj = new SqlConnection();
SqlCommand command = new SqlCommand();
command.Connection = connectionObj;
command.Connection.ConnectionString =
ConfigurationManager.AppSettings["DBConnectionString"];//Specify your
connection string here
command.CommandText = nonQuery;
command.Connection.Open();
try
{
command.ExecuteNonQuery();
}
finally
{
command.Connection.Close();
}
}