Posts

Showing posts from September, 2012

Set the Default Value to the Column Of a Table Programmaticaly

Normally we face this type of problem when we want to set the column default value pro-grammatically. To Solve this problem we need to first get the table column information using this Query. "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='person'" . Here the table name may vary. when we execute this Query we will get the each column information . So based on this we can Iterate the each column and get the each column Information as given below        VB.NET  Private Sub Initialise_The_Table(ByVal ReqTab As String) On Error GoTo handle_error Dim eachTableAdapter As SqlDataAdapter Dim tableDataset As New DataSet Dim adoHelper As SQLHelper = SQLHelper.GetInstance eachTableAdapter = adoHelper.GetAdapter("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + ReqTab + "'") eachTableAdapter.FillSchema(tableDataset, SchemaType.Source, ReqTab) eachTableA