Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
CREATE PROCEDURE hms.`Select_Parameter`(_Branch_Id int ,_Tenant_Id int)
BEGIN
 SELECT a.ParameterName,
             a.Target_Value,
             b.Last_Date,
             b.Result,
             b.Measurement_Frequency,
             b.Next_Due_Date,
             a.Remarks,
             a.Active
        FROM    patient_progress_tracking b
             INNER JOIN
                disease_parameter a
             ON a.ParameterId = b.ParameterId
       WHERE  a.Branch_Id=_Branch_Id and a.Tenant_Id=_Tenant_Id ;

END;



this is my procedure and and below is bindgrid()
C#
protected void BindCarePlan()
       {

           MySqlConnection strConnection = new MySqlConnection();
           strConnection.ConnectionString = StrConn;
           MySqlCommand strCommand = new MySqlCommand();

           try
           {
               strConnection.Open();


                   strCommand.CommandType = CommandType.StoredProcedure;
                   strCommand.CommandText = "Select_Parameter";

               strCommand.Connection = strConnection;

               strCommand.Parameters.AddWithValue("_Tenant_Id", Convert.ToInt32(Session["Tenant_Id"]));
               strCommand.Parameters.AddWithValue("_Branch_Id", Convert.ToInt32(Session["Branch_Id"]));

               MySqlDataAdapter da = new MySqlDataAdapter(strCommand);
               DataTable dt = new DataTable();
               da.Fill(dt);
               grdcareplan.DataSource = dt;
               grdcareplan.DataBind();

           }

           catch (Exception ex)
           {
               obj.InfoEntry(DateTime.Now + "     " + " BindCarePlan" + "     " + "HomeHealthCare.aspx" + "     " + ex.Message, "");
               obj.InfoEntry(DateTime.Now + "     " + ex.StackTrace, "");
               Session["strerrormsg"] = DateTime.Now + "     " + " BindCarePlan" + "     " + "HomeHealthCare.aspx" + "     " + ex.Message;
               Session["strerrortrace"] = DateTime.Now + "     " + ex.StackTrace;
               Response.Redirect("ErrorPage.aspx");
           }

           finally
           {
               // GridViewBill.DataBind();
               strConnection.Close();
           }

       }


i am having dropdownlist of diseasename..which is outside the gridview..by selecting diseasename i want to bind parameter with gridview...
so what should i write in selectedindex changed event of dropdownlist and also what will be the modification in procedure as i am also having DiseaseId Coloumne in disease_parameter table
Posted
Updated 17-Dec-12 23:06pm
v2
Comments
AshishChaudha 18-Dec-12 5:09am    
What problem you are facing?? are you getting any exception??

Hi,

try this

on selectedindex changed event of dropdownlist, you can bind the gridview by passing selected diseases_id (or) diseases name of dropdown list

SQL
CREATE PROCEDURE hms.`Select_Parameter`(_Branch_Id int ,_Tenant_Id int,_Disease_Id int )
BEGIN
 SELECT a.ParameterName,
             a.Target_Value,
             b.Last_Date,
             b.Result,
             b.Measurement_Frequency,
             b.Next_Due_Date,
             a.Remarks,
             a.Active
        FROM    patient_progress_tracking b
             INNER JOIN
                disease_parameter a
             ON a.ParameterId = b.ParameterId
       WHERE  a.Branch_Id=_Branch_Id and a.Tenant_Id=_Tenant_Id and a.DiseaseId=_Disease_Id;

END;
 
Share this answer
 
v3
you can simply call your
VB
BindCarePlan()

on selectedIndexChange of the Dropdownlist ddldisease and pass parameters to the procedure. No need of using session for this.

C#
strCommand.Parameters.AddWithValue("_Tenant_Id", Convert.ToInt32(ddlTenant.SelectedValue));
                strCommand.Parameters.AddWithValue("_Branch_Id", Convert.ToInt32(ddlBranch.SelectedValue));
 
Share this answer
 
v2
SQL
CREATE PROCEDURE hms.`Select_Parameter`(_Branch_Id int ,_Tenant_Id int,_Disease_Id int )
BEGIN
 SELECT a.ParameterName,
             a.Target_Value,
             b.Last_Date,
             b.Result,
             b.Measurement_Frequency,
             b.Next_Due_Date,
             a.Remarks,
             a.Active
        FROM    patient_progress_tracking b
             INNER JOIN
                disease_parameter a
             ON a.ParameterId = b.ParameterId
       WHERE  a.Branch_Id=_Branch_Id and a.Tenant_Id=_Tenant_Id and a.DiseaseId=_Disease_Id;

END;


if i am taking this then what shud i write in selectedindexchanged event of dropdownlis
 
Share this answer
 
I am Only having DiseaseName in dropdownlist
 
Share this answer
 
Comments
Anuja Pawar Indore 18-Dec-12 6:20am    
Post it as a comment, this is not answer

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