Monday, 7 July 2014

M S Access Date Between Query Not Giving Desired Result

Actualy what I will do here is just show you
Examples of using dates as criteria in Access queries



If I was not wrong you were facing problem in Access Database Query of Between   or >< 
for Dates

Actualy it is not as same as SQL to get record from by just putting between keyword...

MS Access must be filterd from  format('<urdate'>,'dd/mm/yyyy')

but lets first focus what you are facing /what wrong you were doing...

WRONG METHODS
SELECT Purchase_Date, Purchase_Billno
FROM Purchase_Item
where format('Purchase_Date,'dd/mm/yyyy')> '02/01/2014'
and format('Purchase_Date,'dd/mm/yyyy')<'22/12/2014'



or 

 SELECT Purchase_Date, Purchase_Billno
FROM Purchase_Item
where format('Purchase_Date,'dd/mm/yyyy')> #02/01/2014#
and format('Purchase_Date,'dd/mm/yyyy')<#22/12/2014#



RIGHT WAY
Lets See How Its Works..

SELECT Purchase_Date, Purchase_Billno
FROM Purchase_Item
where Purchase_Date> format('02/01/2014','dd/mm/yyyy')
and Purchase_Date< format('22/12/2014','dd/mm/yyyy')



This will show you the exact match of your desired result,
So Hows that solution :)


Sunday, 6 July 2014

String First And Last Character by Substring in C#

Let say you have a string and you want its first or last character like first 2 or last 4 how could you do that?

here is sample for that


string mystring = "122014";
      
        mystring = mystring.Substring(mystring.Length - 4);
        Response.Write(mystring.ToString());


//output:2014


 mystring = "122014";
        string sub = mystring.Remove(mystring.Length - 4);
        Response.Write("<br>");
        Response.Write(sub.ToString());


//output: 12

Print Only Grid View in ASP.net

ASP.net How to Print Only GridView < div id ="gridviewDiv" >   < asp:GridView ID ="gridViewToPri...