We Help You To Renovate Your Blogger Blog With Awesomeness!

Sunday, October 26, 2014

  • How to convert DateTime to Date VarChar





    This line of code do the job


    CONVERT(varchar(10), [MyDateTimecolumn], 20)
     
     
    eg: select PKID,CONVERT(varchar(10), createdDate, 20) from tempTable
     
     
     
     
     
  • Best way to check if a Data Table has a null (SQL) value in it


    Hostgator Offers


     Check Whole table



    If you want to check if a null value exists in the table you can use this method:
    public static bool HasNull(this DataTable table)
    {
        foreach (DataColumn column in table.Columns)
        {
            if (table.Rows.OfType<DataRow>().Any(r => r.IsNull(column)))
                return true;
        }
    
        return false;
    }
     
     
    and use 
     
    table.HasNull(); 


     where ever you need


     Checking Specific column


    Compare the value of the column to the DBNull.Value value to filter and manage null values in whatever way you see fit.

     
     
     
     
    foreach(DataRow row in table.Rows)
    {
        object value = row["ColumnName"];
        if (value == DBNull.Value)
            // do something
        else
            // do something else
    }
     
     
    Check More About DBNull Class
     
     
     
     
  • Saturday, October 4, 2014

  • Get 25% Off on HostGator Hosting Coupon Code


    Since started in 2002, Hostgator has been providing World Class web hosting services to its clients in more than 200 countries. Hostgator has been offering world-class solutions around shared hosting, reseller hosting, VPS hosting and dedicated servers to individuals and professionals. Each web hosting solution from Hostgator comes with 24×7 support, 45 money back guarantee and unlimited bandwidth and disk space. 700,000 plus domain owners trust Hostgator web hosting solutions.






    Get 25% Off on HostGator Hosting Coupon Code
  • Wednesday, October 1, 2014

  • Read HTML File C# ASP Stream Reader



    string file = Server.MapPath ("abc.html");
    StreamReader sr;
    FileInfo fi = new FileInfo(file);
    if(File.Exists(file))
    {
         sr = File.OpenText(file);
         input += sr.ReadToEnd();
         sr.Close();
    }
     
     
     
     
     

    Another Method 

     

    string[] lines = File.ReadAllLines("path/to/my/file.html");
    foreach(string line in lines)
    {
        Response.Write(line);
    }

     

     
     
     
     
     
  • Copyright @ 2013 Code Snippets.