Re: What changed with MySqlDbType.Datetime?
Posted by: David Dimmer
Date: November 29, 2004 10:14AM

I have a similiar problem since the new release. Now I can't pass data parameters:

public string FlavorsCountAvailableForShipDate(object ShipDateObject, object TodaysDate)
{
TodaysDate = VerifyDateAgainstTime(Convert.ToDateTime(TodaysDate));
DateTime ShipDate = Convert.ToDateTime(ShipDateObject);
string StartShipDateFormatted = Convert.ToDateTime(TodaysDate).ToString("yyyy-MM-dd").Replace("'","");
string EndShipDateFormatted = ShipDate.ToString("yyyy-MM-dd").Replace("'","");
string Query = "SELECT count(distinct(flavorid)) as FlavorCount FROM Kopps.flavorcalendar WHERE (flavordate >= '" +StartShipDateFormatted+"' AND flavordate < '"+EndShipDateFormatted+"') OR (flavordate = '' OR flavordate IS NULL)";
MySqlParameter[] paramsToPass = new MySqlParameter[2];
string NumberOfFlavors = "0";
// ----
paramsToPass[0] = new MySqlParameter("@StartShipDateFormatted", StartShipDateFormatted);
paramsToPass[1] = new MySqlParameter("@EndShipDateFormatted", EndShipDateFormatted);

MySqlDataReaderLoad = MySqlHelper.ExecuteReader(_connectionString, Query, paramsToPass);
// ----
try
{
MySqlDataReaderLoad.Read();
NumberOfFlavors = MySqlDataReaderLoad["FlavorCount"].ToString();
}
catch
{
NumberOfFlavors = "0";
}
finally
{
MySqlDataReaderLoad.Close();
}
// ----
return NumberOfFlavors;
}



Am I doing something wrong?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.