Click here to Skip to main content
15,063,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am facing some problem while updating some data to database(Oracle) through a procedure using dataadapter's update method.

Following is the code:

int Ret;
OracleConnection MyConnection = new OracleConnection();
MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
MyConnection.Open();
OracleCommand MyCommand = new OracleCommand();
OracleDataAdapter MyDataAdapter = new OracleDataAdapter();
MyCommand.Connection = MyConnection;
MyCommand.CommandType = CommandType.StoredProcedure;
string DBUserName = ConfigurationManager.AppSettings["DBUSERNAME"].ToString();
MyCommand.CommandText = DBUserName + ".PKG_EMPLOYEE_INFO.ENTER_LEAVE_DET";
OracleTransaction TRAN;
TRAN = MyConnection.BeginTransaction();
MyCommand.Transaction = TRAN;
MyCommand.Parameters.Clear();
MyCommand.Parameters.AddWithValue("@USER_FK_IN", Session["USER_PK"]);
MyCommand.Parameters.Add("@LEAVE_DATE_IN", OracleType.DateTime, 20, "LEAVE_DATE");
MyCommand.Parameters["@LEAVE_DATE_IN"].SourceVersion = DataRowVersion.Current;
MyCommand.Parameters.Add("@HALF_FULL_IN", OracleType.DateTime, 20, "HALF_FULL");
MyCommand.Parameters["@HALF_FULL_IN"].SourceVersion = DataRowVersion.Current;
MyCommand.Parameters.Add("@RETURN_VALUE", OracleType.VarChar, 30, "RETURN_VALUE").Direction = ParameterDirection.Output;
try
{
MyDataAdapter.RowUpdated += new System.Data.OracleClient.OracleRowUpdatedEventHandler(OnRowUpdated);
MyDataAdapter.InsertCommand = MyCommand;
MyDataAdapter.InsertCommand.Transaction = TRAN;
DataSet FullDS = new DataSet();
FullDS = (DataSet)ViewState["FULLDS"];
DataSet HalfDS = new DataSet();
HalfDS = (DataSet)ViewState["HALFDS"];
//LeaveDS = (DataSet)ViewState["LEAVEDS"];
FullDS.Merge(HalfDS);
Ret = MyDataAdapter.Update(FullDS);
if (arrMessage.Count > 0)
{
TRAN.Rollback();
}
else
{
TRAN.Commit();
Ret = Convert.ToInt16(MyCommand.Parameters["RETURN_VALUE"].Value);
}
}
catch (Exception ex)
{
TRAN.Rollback();
Ret = 0;
}
finally
{
MyConnection.Close();
}

But I am getting the following error at "
SQL
Ret = MyDataAdapter.Update(FullDS);

":

?ex.Message
"Update unable to find TableMapping['Table'] or DataTable 'Table'."

The FullDS is having the following status.
FullDS.Tables.Count = 1
FullDS.Tables[0].Rows.Count = 8

Please, anybody tell me why i am getting this error?
Posted

1 solution

1. Check your StoredProcedure
2. Check your the type of column
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900