Monday, February 28, 2011

Create Data Table and Data Row.

Table name "WorkAddress"
Table Columns name , type


Public Function MyDataTable() As DataTable

Dim dt As DataTable

dt = New DataTable()
dt.TableName = "WorkAddress"

dt.Columns.Add("name")
dt.Columns.Add("type")

Dim r As DataRow

r = dt.NewRow()
r(0) = "id"
r(1) = "uniqueidentifier"
dt.Rows.Add(r)

r = dt.NewRow()
r(0) = "street"
r(1) = "smallint"
dt.Rows.Add(r)

r = dt.NewRow()
r(0) = "address"
r(1) = "varchar"
dt.Rows.Add(r)

r = dt.NewRow()
r(0) = "city"
r(1) = "varchar"
dt.Rows.Add(r)

r = dt.NewRow()
r(0) = "state"
r(1) = "varchar"
dt.Rows.Add(r)

Return dt

End Function