Wednesday, January 31, 2007

ASP.NET AJAX v1.0 Released

From Abhishek Kant Blog

The AJAX framework from Microsoft (codenamed Atlas) has now being released as V1.0. this means that it is fully supported and orgranisations can start using the same in their mainline applications.

download the framework from: http://ajax.asp.net

Exporting DataTable to CSV File Format

    protected void Button1_Click(object sender, EventArgs e)
    {

        string strConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

        SqlConnection conn = new SqlConnection(strConn);

        SqlDataAdapter da = new SqlDataAdapter("select * from employees", conn);

        DataSet ds = new DataSet();

        da.Fill(ds, "Emp");

        GridView1.DataSource = ds.Tables["Emp"].DefaultView;

        GridView1.DataBind();

        DataTable dt = ds.Tables["Emp"];

        CreateCSVFile(dt, "c:\\csvData.csv");

    }

 

 

    public void CreateCSVFile(DataTable dt, string strFilePath)

    {

        #region Export Grid to CSV

 

        // Create the CSV file to which grid data will be exported.

        StreamWriter sw = new StreamWriter(strFilePath, false);

        // First we will write the headers.

        //DataTable dt = m_dsProducts.Tables[0];

        int iColCount = dt.Columns.Count;

        for (int i = 0; i < iColCount; i++)

        {

            sw.Write(dt.Columns[i]);

            if (i < iColCount - 1)

            {

                sw.Write(",");

            }

        }

        sw.Write(sw.NewLine);

        // Now write all the rows.

        foreach (DataRow dr in dt.Rows)

        {

            for (int i = 0; i < iColCount; i++)

            {

                if (!Convert.IsDBNull(dr[i]))

                {

                    sw.Write(dr[i].ToString());

                }

                if (i < iColCount - 1)

                {

                    sw.Write(",");

                }

            }

            sw.Write(sw.NewLine);

        }

        sw.Close();

 

        #endregion

    }

Monday, January 22, 2007

Code Formatting Utility for Blog

While Browsing come across a Code Formatting Utility for Blog.

This code formatting utility facilitates for formatting code for

1) C#
2) VB
3) html/xml/aspx
4) t-sql
5) msh

Convert Code to Html format for Blog posting

http://www.manoli.net/csharpformat/

Wednesday, January 03, 2007

MVP Award 2007



Recived an Email from Mr. Abhishek Kant (MVP Lead.) stating a winner of MVP award 2007 for ASP.net as expertise area. Its the best gift at the starting of new year from Microsoft.

Most Recent Post

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape