www.kevincornwell.com

Archive



.NET ConnectionString Encyption

The following command will encrypt your connection sting in your web.config file. The connection string must all ready be in place.

For C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

-pkm switch encrypts the machine.config rather and web.config (default).

aspnet_regiis.exe -pef "connectionStrings" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config" -prov "DataProtectionConfigurationProvider"

Post Comment Now


SharePoint Error PublicKeyToken=b77a5c561934e089 failed

This post has been moved to mySharePointBlog. Go Here.


Post Comment Now


ASP.NET Excel Function

This function written in c# builds a MS excel out of a dataSet.

    private DataSet dataSet = new DataSet();
    private DataView dView = new DataView();
 
    private void LoadPeople()
    {
        SqlConnection conn = new SqlConnection("Data Source=asdf;User ID=asdf;Password=asdf;Database=Directory");
        SqlDataAdapter dAdapter = new SqlDataAdapter("SELECT * FROM People", conn);
        dAdapter.Fill(dataSet, "peeps");
        dView.Table = dataSet.Tables["peeps"];
        personel_cnt = dView.Count;
        dView.Table.Columns.Add("is_a_member");
        conn.Close();
    }
 
    private void buildExcelReport()
    {
        DataSet dsExport = dataSet;
        System.IO.StringWriter tw = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter hw =
           new System.Web.UI.HtmlTextWriter(tw);
        DataGrid dgGrid = new DataGrid();
        dgGrid.DataSource = dsExport;
 
        //Report Header
        hw.WriteLine("My Super Duper Excel Report");
        hw.WriteLine("<br>∓nbsp;");
        // Get the HTML for the control.
        dgGrid.HeaderStyle.Font.Bold = true;
        dgGrid.DataBind();
        dgGrid.RenderControl(hw);
 
        // Write the HTML back to the browser.
        Response.ContentType = "application/vnd.ms-excel";
        this.EnableViewState = false;
        Response.Write(tw.ToString());
        Response.End();
    }

Post Comment Now


WSS 3.0 API Notes

This post has been moved to mySharePointblog. Go here.


Comments Off


Blog | Contact | Gallery | Links | Google Latitude (location) | Music | Sandbox | Search | SharePoint | Social Networking | Software | Weather | Web Design


Copyright © 1997-2009 KCSH. All rights reserved.