I am getting an issue when fetching the values from database (i.e) when I am fetching the values using the Mysqldataadapter I am getting null values but when I close the solution and restart the application I get the values correctly this happens mostly when fetching the data from database not when inserting into the Db I am pasting my connection string details and the code with this pl tell me where I went worng
public string getManagerDetails(string strAssId)
{
MySqlConnection strCon = new MySqlConnection(strConnection);
strCon.Open();
MySqlCommand cmdMgrDetails = new MySqlCommand("sp_getManagerDetails", strCon);
MySqlDataAdapter daMgrDetails = new MySqlDataAdapter(cmdMgrDetails);
DataTable dtMgrDetails = new DataTable();
cmdMgrDetails.Parameters.Add("@assoId", MySqlDbType.Int32).Value = Convert.ToInt32(strAssId.Trim());
daMgrDetails.SelectCommand.CommandType = CommandType.StoredProcedure;
daMgrDetails.Fill(dtMgrDetails);
if (dtMgrDetails.Rows.Count != null || dtMgrDetails.Rows.Count.ToString() != "")
{
return dtMgrDetails.Rows[0]["associate_fname"].ToString();
}
else
{
return "";
}
strCon.Close();
}
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_getManagerDetails`(In assoId integer)
BEGIN
select associate_fname from associate_details where associate_id=
(select manager_id from associate_details where associate_id=assoId);
END