Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET MySQL
DROP PROCEDURE IF EXISTS hms.Select_LastDate_Result;
CREATE PROCEDURE hms.`Select_LastDate_Result`()
BEGIN
      SELECT Current_Test_Date as 'Last_Date'
                FROM patient_progress_tracking_details
              ORDER BY Current_Test_Date DESC limit 1;
       SELECT Test_Result as 'Result'
                FROM patient_progress_tracking_details
              ORDER BY Current_Test_Date DESC limit 1;
   END;
this is my cs file..
 protected void Imgbtnsave_Click(object sender, ImageClickEventArgs e)
        {
            
            MySqlConnection StrConnection = null;
            MySqlCommand StrCommand = null;
            try
            {
                StrConnection = new MySqlConnection();
                StrConnection.ConnectionString = StrConn;
                StrConnection.Open();
 
                StrCommand = new MySqlCommand();
                StrCommand.CommandType = CommandType.StoredProcedure;
                StrCommand.CommandText = "Select_LastDate_Result";
                StrCommand.Connection = StrConnection;
 
                StrCommand.ExecuteNonQuery();
                BindCarePlan();
            }
            catch (Exception ex)
            {
                obj.InfoEntry(DateTime.Now + "     " + "BtnSave1_Click" + "     " + "AccountBalance.aspx" + "     " + ex.Message, "");
                obj.InfoEntry(DateTime.Now + "     " + ex.StackTrace, "");
                Session["strerrormsg"] = DateTime.Now + "     " + "BtnSave1_Click" + "     " + "AccountBalance.aspx" + "     " + ex.Message;
                Session["strerrortrace"] = DateTime.Now + "     " + ex.StackTrace;
                Response.Redirect("ErrorPage.aspx");
            }
            finally
            {
                StrConnection.Close();
                StrConnection.Dispose();
            }          
        }
    }
this code is not working..
Posted 4-Jan-13 21:21pm
ujali428
Edited 4-Jan-13 21:38pm
v2
Comments
Dorababu743 at 5-Jan-13 6:54am
   
Any error?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
Sandeep Mewara at 5-Jan-13 3:39am
   
Sure would help. My 5!
Abhinav S at 5-Jan-13 4:24am
   
Thanks Sandeep.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

StrConnection.ConnectionString = StrConn;
StrConnection.Open();

StrCommand = new MySqlCommand();
StrCommand.CommandType = CommandType.StoredProcedure;
StrCommand.CommandText = "Select_LastDate_Result";
StrCommand.Connection = StrConnection;
 
instead above code use following:
 
StrCommand= new SqlCommand("Select_LastDate_Result", StrConnection);
cmd.CommandType = CommandType.StoredProcedure;
connection.Open();
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

you can do it so many ways but i give you simple ways
 
that is you change your SP
LIke:-
 
CREATE PROCEDURE hms.`Select_LastDate_Result`()
BEGIN
SELECT Current_Test_Date as 'Last_Date',Test_Result as 'Result'
FROM patient_progress_tracking_details
ORDER BY Current_Test_Date DESC limit 1;
 
--------------------------------
then you call this stored procedure as you calling above;
 
and other way you can used using out parameter sql
 
to search out parameter click following link:-
 
http://msdn.microsoft.com/en-us/library/ms187004(v=sql.105).aspx[^]
 
http://sqlserverpedia.com/wiki/Stored_Procedures_-_Output_Parameters_%26_Return_Values[^]
 

 
if problem exist than give your comment.....
  Permalink  
Comments
ujali at 5-Jan-13 11:02am
   
thank u...this is what want...

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

  Print Answers RSS
0 George Jonsson 359
1 Sergey Alexandrovich Kryukov 355
2 CPallini 335
3 BillWoodruff 324
4 OriginalGriff 237
0 OriginalGriff 5,050
1 CPallini 4,225
2 Sergey Alexandrovich Kryukov 3,639
3 George Jonsson 2,911
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 5 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100