Archive / February, 2008

ASP.Net CAPTCHA Control

Hello,  I recently had a need to display a CAPTCHA on an ASP.Net contact form. After a short search on the internet, I found this article on the The Code Project: http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx This Captcha control by Jeff Atwood was easy to plug in and works very well for my needs. I just wanted to let […]

Code to create a DataSet

Use this code to create a table and place it in a DataSet. // Create a new DataTable.System.Data.DataTable table = new DataTable(“Details”);// Declare variables for DataColumn and DataRow objects.DataColumn column;DataRow row;// Create new DataColumn, set DataType, // ColumnName and add to DataTable. column = new DataColumn();column.DataType = System.Type.GetType(“System.Int32”);column.ColumnName = “fk_agent_id”;column.ReadOnly = false;column.Unique = true;// Add the Column to […]

Code to create a DataRow and add it to a DataSet

Use this code to create a DataRow from a table in a DataSet and place it in the table in a DataSet. // Call a method to create the DataSet with a table in it.DataSet resultData = MakeDetailTable();DataRow row = resultData.Tables[“Details”].NewRow();row[“fk_agent_id”] = userInfo.account_id;row[“agent_name”] = userInfo.lname + “, “ + userInfo.fname;resultData.Tables[“Details”].Rows.Add(row);// Use the data in the GridView.gvReport.DataSource = […]