This is what I am currently trying:
var value = Datepicker1.Value;
List<ChartData> data = new List<ChartData>();
string connetionString;
MySqlConnection cnn;
connetionString = “TAKEN OUT FOR SECURITY”;
cnn = new MySqlConnection(connetionString);
cnn.Open();
MySqlDataAdapter da = new MySqlDataAdapter("SELECT SUBSTRING(date_time,1,10), sum(Total), sum(Total_ly), AVG ((Total + Total_ly)/2) FROM Transaction WHERE Substring(date_time,1,10) LIKE '%@param1%' Group By date_time Having sum(Total)<>0; ", cnn);
da.SelectCommand.Parameters.AddWithValue("@param1", value);
DataTable table = new DataTable();
da.Fill(table);
So, all im trying to do is this: WHERE Substring(date_time,1,10) like '%2/24/2019%' Thats the hardcoded version i just need to have this stored in a variable and check the variable rather than the hardcoded string if that makes sense ?
But its not working ! And is giving no SQL exception !
Any help appreciated.
date_timecolumn and what is an example value if its not a DATETIME.