DateTime curdate = DateTime.Now; curdate = curdate.AddDays(-30); // if i give -4 instead of -30 the query will bind data DateTime curdate1 = DateTime.Now; validateDept.InitializeConnection(); OleDbConnection connection = new OleDbConnection(validateDept.connetionString); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT InvoiceId, InvoiceNumber, InvoiceDate, (Select CustomerId from Customer Where Customer.CustomerId=NewInvoice_1.CustomerName) AS CustomerId, (Select CustomerName from Customer where Customer.CustomerId = NewInvoice_1.CustomerName) AS CustomerName, DueDate, Tax, GrandTotal, CompanyId FROM NewInvoice_1 WHERE InvoiceDate >= '" + curdate + "' AND InvoiceDate <= '" + curdate1 + "' ", connection); DataSet sourceDataSet = new DataSet(); adapter.Fill(sourceDataSet); gridControl1.DataSource = sourceDataSet.Tables[0];
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)