Monday, 27 August 2012

Error converting data type nvarchar to date in asp.net


      protected void btnDisplay_Click(object sender, EventArgs e)
        {
            Hashtable ht = new Hashtable();
            ArrayList arrlst = new ArrayList();


            string fromdt = txtFromDate.Text.Substring(txtFromDate.Text.Length - 4) + "/"     + txtFromDate.Text.Substring(3, 2) + "/" + txtFromDate.Text.Substring(0, 2);
            string todt = txtTodate.Text.Substring(txtTodate.Text.Length - 4) + "/" + txtTodate.Text.Substring(3, 2) + "/" + txtTodate.Text.Substring(0, 2);


            arrlst.Add(fromdt);
            arrlst.Add(todt);

            DataSet ds = bal.Search_InventoryDetails(arrlst);
            GrdInventory.DataSource = ds.Tables[0];
            GrdInventory.DataBind();
           
        }

1 comment: