string ConnectionString =“Provider = MSDAORA; Data Source = orcl; Persist Security Info = True; User ID = web; password = web”;
OleDbConnection MyOleDbConnection = new OleDbConnection(ConnectionString);
OleDbCommand MyOleDbCommand = MyOleDbConnection.CreateCommand();
MyOleDbCommand.CommandText = "insert into SL_Trans_Booking_hdr (Distributor_name, Booking_date) values (@customer, @date)";
MyOleDbCommand.Parameters.AddWithValue("@customer", TextBox1.Text);
MyOleDbCommand.Parameters.AddWithValue("@date", TextBox2.Text);
try
{
MyOleDbConnection.Open();
int a = MyOleDbCommand.ExecuteNonQuery();
if (a > 0)
{
Response.Write("Go Ahead");
}
else
{
Response.Write("Try again");
}
}
catch (Exception err)
{
Console.WriteLine("{0}", err);
}
finally
{
MyOleDbConnection.Close();
}