locked
ExecuteScalar: Connection property has not been initialized. RRS feed

  • Question

  • User1469062072 posted

    hi

    i have this erroer

    ExecuteScalar: Connection property has not been initialized.

    when i excute this qury:

     cmd.CommandText = "select PID from Reservation where username='" + Session["username"].ToString() + "' ";
            string str = cmd.ExecuteScalar().ToString();
             string cmd1  = " select  Pname, Gender , Status , Medicin, Comment , Bill from Report where PID = '"+Convert.ToInt32( str)+ "'";

     cmd.CommandText = "select PID from Reservation where username='" + Session["username"].ToString() + "' ";

            string str = cmd.ExecuteScalar().ToString();



             string cmd1  = " select  Pname, Gender , Status , Medicin, Comment , Bill from Report where PID = '"+Convert.ToInt32( str)+ "'";

    Wednesday, December 23, 2009 2:28 PM

Answers

All replies