in table one record already saved like formate 01/06/2012
now
i want get all data which is related by this date but i want search this record by just month formate not total date how can?
exp:
month_cbx = my combobox which is already enterd month numbers 1 to 12...
" String.formate(select * from tablename where date=@date(MM),month_cbx.text");
plz explain this
Loading
Anil KumarPosted Jun 5, 2012, 12:30 PM
SaqiPosted Jun 5, 2012, 7:53 AM
i got it .... actulay i was need convert combobox into integer..
SaqiPosted Jun 5, 2012, 7:22 AM
i tried your code but have some error of invalid date format.
first of all the datatype of my date column in table is DATETIME..
secondly does not matter about year .. i want just pick month of stored date.
date is 01/06/2012.. now plz write complete query...
1 to 12 numbers already store in combobox..
StringBuilder query = new StringBuilder();
query.Append("select * from mytable ");
query.Append(" Where numero=@numero And ");
query.Append(String.Format(" Month(date)={0}",comboBox1.Text));
Anil KumarPosted Jun 4, 2012, 10:28 PM
If you consider some by default year then it is possible or you have to take input for year also.
So get the input for year OR consider current year/any year as a default year and then write your query with
MONTH(date)=