asp.net - String was not recognized in valid datetime -


I tried with different formats but still giving it an exception.

I am trying to show the dataset in Gridview using the selection command.

I used the expansion column in the form of a date datatype in the SQL Server table.

My code is here.

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Using System.Data; Using System.Data.SqlClient; Public Partial Segment Consolidated Bimonath: Systems Web. UI page {double grade = 0; Protected Zero Page_Load (Object Sender, EventArgs E) {} Secure void btnShowExpenses_Click (Object Sender, EventArgs e) {string month = DropDownList1.Text; String no muff = ""; String day = ""; Switch (Month) {Case "Jan": No Moff = "01"; Day = "31"; break; Case "February": No Offmon = "02"; Day = "28"; break; Case "March": No Moff = "03"; Day = "31"; break; Case "April": No Moff = "04"; Days = "30"; break; Case "May": Knopfone = "05"; Day = "31"; break; Case "June": Nophmonoth = "06"; Days = "30"; break; Case "July": No Offmonth = "07"; Day = "31"; break; Case "August": Nophomon = "08"; Day = "31"; break; Case "September": Nophomon = "09"; Days = "30"; break; Case "October": no ophmon = "10"; Day = "31"; break; Case "November": no moff = "11"; Days = "30"; break; Case "Dec.": No Moff = "12"; Day = "31"; break; } String str1 = (knopfon + "01" + dropdown list 2. text). Ostring (); // 04012014 string str2 = (nophone + day + dropdown list 2. text). Ostring (); Date time Date 1 = Date time.Parse AXact (SR1, "YAY-MM-DD", empty); DateTime2 = DateTime Parsexact (Straw 2, "YYA-MM-DD", blank); String con_string = "@data source = 10.10.10.5; initial list = test azr; user = xx; password = xxxxx;"; SqlConnection con = new SqlConnection (con_string); String qry = "Expense_Category, Expense_Description, The amount of Expense 3 from the company where Expense_Date> =" + date1 + "and   

Please correct me

Write something like this ..

  string str1 = (nophophthous + "/ 01 /" dropdown list 2. text). Ostring (); // 04012014 string str2 = (NoOfMonth + "/" + day + "/" + DropDownList2.Text) .ostring (); DateTime1 = DateTime Parsextact (CR1, "MM / DD / YYYA", System Glossisation. CelticInfo. InverterTech); DateTime2 = DateTime Parsexact (Straw 2, "MM / DD / Yay", System Glossisation. Culturoinf.Invalian Culture);    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -