RT News

Friday, December 20, 2013

C Sharp Code

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; namespace WebApplication1 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { int aa = 0; try { OracleConnection conn = new OracleConnection("Data Source=ORCL;User ID=system;Password=Oracle2013;"); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "insert into PRODUCT (PRODUCTID,PRODUCTNAME,PRICE,PRODUCTDESCRIPTION) values ('" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "')"; aa = cmd.ExecuteNonQuery(); if (aa == 0) TextBox1.Show("record not inserted"); else TextBox1.Show("record inserted"); conn.Close(); } }

No comments: