Indhu Mathi

Indhu Mathi

  • NA
  • 60
  • 6.5k

Cannot create an instance for oraclecommand

Jun 9 2017 6:57 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OracleClient;
using System.Configuration;
using System.Data;
namespace Employee
{
public partial class ChangePassword : System.Web.UI.Page
{
public void Page_Load(object sender, EventArgs e)
{
}
public void Updatepassword()
{
try
{
OracleConnection connUpdatepassword = new OracleConnection(ConfigurationManager.AppSettings["updatepassword"].ToString());
OracleCommand cmdUpdatepassword = new OracleCommand("insert_emp_info", connUpdatepassword);
connUpdatepassword.Open();
cmdUpdatepassword.CommandType = System.Data.CommandType.StoredProcedure;
cmdUpdatepassword.Parameters.Add(new OracleParameter("i_emp_id", Convert.ToInt64("568877")));
cmdUpdatepassword.Parameters.Add(new OracleParameter("i_emp_password", txtConfirmPassword.Text.ToString()));
int rows=cmdUpdatepassword.ExecuteNonQuery();
if(rows==1)
{
lblupdatemss.Visible=true;
}
connUpdatepassword.Close();
}
catch (Exception ex)
{
lblErrormsg.Visible=true;
lblErrormsg.Text=ex.Message.ToString();
}
}
public void btnSubmit_Click(object sender, EventArgs e)
{
Updatepassword();
}
}
}
 
This is my code i tried to create an instance but it shows an exception Message = "Object reference not set to an instance of an object." 

Answers (2)