please suggest the correct solution(string FromDate,string ToDate)
{
OleDbConnection xlConn = new OleDbConnection(ConnectionString);
using (xlConn)
OleDbDataAdapter dAd = new OleDbDataAdapter(@"SELECT tbC.ContID , tbC.Posted_User,
tbC.Content, tbC.PostedDate, tbG.Catg_Name ,tbP.PU_Name FROM
((tblAllContent tbC INNER JOIN tblCatg tbG ON tbC.Catg_ID = tbG.CID)
INNER JOIN tblPU tbP ON tbC.PU_ID = tbP.PID) AND tbc.PostedDate BETWEEN "+FromDate + "AND "+ToDate , xlConn);
DataTable dt = new DataTable();
try
xlConn.Open();
dAd.Fill(dt);
return dt;
}
catch (Exception ex)
return null;
finally
xlConn.Close();
xlConn.Dispose();