By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,899 Members | 1,230 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,899 IT Pros & Developers. It's quick & easy.

Exception "Function does not exist" calling existing function in Webservice (Json)

P: 2
The exception is "Function does not exist".But the fuction is actually exist and which is already working in a button click.A particular user only have the permission to do this.And in button click which is written using conditions.Is there any problem of mysql function permission?Webservice is in the form of url and i already pass the specific user id.Please reply me..
This is the code,
Expand|Select|Wrap|Line Numbers
  1. public ActionResult AddPatientTreatment(string patientid, string treatmentid, string treatmentdate, string doctorname, string remarks, string doctorid, string paymentstatus, string paymentpaiddate,string ipid)
  2.         { 
  3.          string result = string.Empty, DateTimeFormat = string.Empty;
  4.             try
  5.             {
  6.                 _performtreatmentBAL.PatientId = Convert.ToInt32(patientid);
  7.                 _performtreatmentBAL.TreatmentId = Convert.ToInt32(treatmentid);
  8.                 if (treatmentdate != string.Empty)
  9.                 {
  10.                     DateTimeFormat = ClinicSettingsBLL.GetDateTimeFormate();
  11.                     _performtreatmentBAL.TreatmentDate = Common.ChangeFormat(DateTimeFormat, treatmentdate);
  12.                 }
  13.                 else
  14.                 {
  15.                     _performtreatmentBAL.TreatmentDate = DateTime.Now;
  16.                 }
  17.                 _performtreatmentBAL.Doctor = doctorname;
  18.                 _performtreatmentBAL.Remarks = remarks;
  19.                 _performtreatmentBAL.DoctorID = Convert.ToInt32(doctorid);
  20.                 _performtreatmentBAL.PaymentPaidStatus = false;
  21.                 _performtreatmentBAL.PaymentPaidDate = DateTime.Now;
  22.                 _performtreatmentBAL.IPId = ipid;
  23.                 result = Convert.ToString(AddPatientTreatments());
  24.  
  25.                 var data = new { status = 200, message = "{'AddPatientTreatmentResult' : [{'result':'" + result + "'}]}" };
  26.                 return Json(data, JsonRequestBehavior.AllowGet);
  27.                 //return GetXmlForResult("AddPatientTreatmentResult", result);
  28.  
  29.             }
  30.             catch (Exception ex)
  31.             {
  32.                 var data = new { status = 501, message =ex.Message };
  33.                 return Json(data, JsonRequestBehavior.AllowGet);
  34.                 //return GetXmlForResult("Error", ex.Message);
  35.             }
  36.  
  37.         }
  38.  
  39.   public int AddPatientTreatments()
  40.         {
  41.             try
  42.             {
  43.  
  44.  
  45.                 //ActivityLog.InsertActivity(Convert.ToString(DateTime.Now), "AddPatientTreatment()", "Use for insert patient treatment", "Doctor", "Before", System.Web.HttpContext.Current.Session["UserID"].ToString(), "", "");
  46.                 //********************************************************************************************************************************************************************************************************
  47.                 MySqlConnection conn = new MySqlConnection(ConnectionString());
  48.                 MySqlCommand cmd = new MySqlCommand("insertpatienttreatment", conn);
  49.                 cmd.CommandType = CommandType.StoredProcedure;
  50.                 cmd.Parameters.Add(new MySqlParameter("param1", _performtreatmentBAL.PatientId));
  51.                 cmd.Parameters.Add(new MySqlParameter("param2", _performtreatmentBAL.TreatmentId));
  52.                 cmd.Parameters.Add(new MySqlParameter("param3", string.Format("{0:s}", Convert.ToDateTime(_performtreatmentBAL.TreatmentDate))));
  53.                 cmd.Parameters.Add(new MySqlParameter("param4", _performtreatmentBAL.Doctor));
  54.                 cmd.Parameters.Add(new MySqlParameter("param5", _performtreatmentBAL.Remarks));
  55.                 cmd.Parameters.Add(new MySqlParameter("param6", _performtreatmentBAL.DoctorID));
  56.                 cmd.Parameters.Add(new MySqlParameter("param8", _performtreatmentBAL.PaymentPaidStatus));
  57.                 cmd.Parameters.Add(new MySqlParameter("param9", _performtreatmentBAL.PaymentPaidDate));
  58.                 cmd.Parameters.Add(new MySqlParameter("?param7", MySqlDbType.Int32));
  59.                 cmd.Parameters["?param7"].Direction = ParameterDirection.ReturnValue;
  60.                 cmd.Parameters.Add(new MySqlParameter("param10", _performtreatmentBAL.IPId));
  61.                 conn.Open();
  62.                 cmd.ExecuteNonQuery();
  63.                 object obj = new object();
  64.                 obj = (object)(cmd.Parameters["?param7"].Value);
  65.                 this._performtreatmentBAL.PatientTreatmentId = Convert.ToInt32(obj);
  66.                 cmd.Connection.Close();
  67.                 conn.Close();
  68.                 //********************************************************************************************************************************************************************************************************
  69.                 //ActivityLog.InsertActivity(Convert.ToString(DateTime.Now), "AddPatientTreatment()", "Use for insert patient treatment", "Doctor", "After", System.Web.HttpContext.Current.Session["UserID"].ToString(), "", "");
  70.                 return this._performtreatmentBAL.PatientTreatmentId;
  71.             }
  72.             catch (Exception e)
  73.             {
  74.                 //ActivityLog.InsertActivity(Convert.ToString(DateTime.Now), "AddPatientTreatment()", "Use for insert patient treatment", "Doctor", "Error", System.Web.HttpContext.Current.Session["UserID"].ToString(), "", e.Message.ToString());
  75.                 //********************************************************************************************************************************************************************************************************
  76.                 ErrorLogBAL.InsertException(e.Message, "InsertPatientTreatment");
  77.                 return 0;
  78.  
  79.             }
  80.         }
  81.  
Jan 17 '13 #1
Share this Question
Share on Google+
4 Replies


PsychoCoder
Expert Mod 100+
P: 465
Without seeing your code it's near impossible for us to offer any kind of assistance. When you post your code please format it with the <CODE/> button
Jan 17 '13 #2

Rabbit
Expert Mod 10K+
P: 12,359
You need to tell us which function is throwing the error and which line of code is causing it. I'm not going to read through hundreds of lines of code to try to find it for you when you can just tell us.
Jan 17 '13 #3

P: 2
Function AddPatientTreatments shows error.While debugging it run upto line 62.then it goes to exception"Function does not exist"
Jan 18 '13 #4

Rabbit
Expert Mod 10K+
P: 12,359
I can't find a reference to a function named object().
Jan 18 '13 #5

Post your reply

Sign in to post your reply or Sign up for a free account.