Feed on
Posts
Comments

Archive for December, 2007

The script:
USE SomeDB

DECLARE @name varchar(128), @sql varchar(500)

DECLARE procs CURSOR FAST_FORWARD FOR

SELECT name FROM sysobjects WHERE type = ‘U’ ORDER BY name ASC FOR READ ONLY

OPEN procs

FETCH next FROM procs INTO @name

WHILE [...]

Read Full Post »

X509 Certificate Installation

Here are the steps of installing an X509 certificate in windows:
Installation Steps for DEVAssumptions:

The Microsoft Windows SDK exists on the machine
The certificate name is SomeName

Go to Start > All Programs > Microsoft Windows SDK > CMD Shell
Execute the following command: makecert -r -pe -n “CN=SomeName” -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr LocalMachine -sky [...]

Read Full Post »

Reusable Data Layer In C#

The goal here is to take advantage of C# 2.0 features as generics and create a reusable data layer capable of calling any stored procedure, with any sets of parameters and returning different sets of results.
The DataUtility class:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Generic;
using System.Data.SqlClient;

///
/// Summary description for DataUtility
///
namespace Data
{
[...]

Read Full Post »

Sometimes, there is a need to post a form from one page to another without any UI element. This is how to do it programmatically:
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(“FormElementName=” + formElementValue);
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(http://somesite/somepage);
myRequest.Method = “POST”;
myRequest.ContentType = “application/x-www-form-urlencoded”;
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();

Read Full Post »