protected void AspxSubmit_Click(object sender, EventArgs e)
    {
        System.Data.OracleClient.OracleConnection objConn;
        System.Data.OracleClient.OracleCommand objCmd;
        String strConnString, strSQL;

        strConnString = "Data Source=xxxx;User Id=xxxx;Password=xxxxx;";

        objConn = new System.Data.OracleClient.OracleConnection(strConnString);
        objConn.Open();

        //*** FOR INSERT ***//
		strSQL = "INSERT INTO customer (CustomerID,Name,Email,CountryCode,Budget,Used) " +
		"VALUES (:sCustomerID,:sName,:sEmail,:sCountryCode,:sBudget,:sUsed)";

        objCmd = new System.Data.OracleClient.OracleCommand(strSQL,objConn);

		//*** Sample 1 ***//
		/*
        objCmd.Parameters.AddWithValue(":sCustomerID","C005");
        objCmd.Parameters.AddWithValue(":sName","Weerachai Nukitram");
        objCmd.Parameters.AddWithValue(":sEmail","webmaster:thaicreate.com");
        objCmd.Parameters.AddWithValue(":sCountryCode","TH");
        objCmd.Parameters.AddWithValue(":sBudget","2000000");
        objCmd.Parameters.AddWithValue(":sUsed","1000000");
		*/

		//*** Sample 2 ***//
		objCmd.Parameters.Add(new OracleParameter(":sCustomerID","C005"));
		objCmd.Parameters.Add(new OracleParameter(":sName","Weerachai Nukitram"));
		objCmd.Parameters.Add(new OracleParameter(":sEmail","webmaster:thaicreate.com"));
		objCmd.Parameters.Add(new OracleParameter(":sCountryCode","TH"));
		objCmd.Parameters.Add(new OracleParameter(":sBudget","2000000"));
		objCmd.Parameters.Add(new OracleParameter(":sUsed","1000000"));

        objCmd.ExecuteNonQuery();

		//lblText.Text = lblText.Text + "- Record Inserted";

		//*** FOR UPDATE ***'
		/*
		strSQL = "UPDATE customer SET Budget = :sBudget " +
		" WHERE CustomerID = :sCustomerID ";

        objCmd = new System.Data.OracleClient.OracleCommand(strSQL,objConn);
        objCmd.Parameters.Add(new OracleParameter(":sBudget","4000000"));
		objCmd.Parameters.Add(new OracleParameter(":sCustomerID","C005"));
        objCmd.ExecuteNonQuery();

        */
    }

 

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.