Databases Reference
In-Depth Information
else //custom fields : must build table/view
{
this.useDefaultTable = false; //don't use default table
//remove table if exists - add new
if(this.dataSet.Tables.Contains(tempTableName))
{
this .dataSet.Tables.Remove(tempTableName);
}
FCLData.DataTable table = new FCLData.DataTable(tempTableName);
//loop through column matches
while(fieldMatch.Success)
{
if(dataSet.Tables[tableName].Columns.Contains(fieldMatch.Value))
{
FCLData.DataColumn col = this.dataSet.Tables[tableName].Columns[fieldMatch.Value] ;
table.Columns.Add(new FCLData.DataColumn(col.ColumnName,col.DataType));
fieldMatch = fieldMatch.NextMatch();
}
else
{
throw new ArgumentException(“Invalid column name”);
}
}
//add temptable to internal dataset and set view to tempView;
this.dataSet.Tables.Add(table);
this.dataView = new FCLData.DataView(table);
}
}
VB.NET
Private Sub ValidateFieldNames(ByVal cmdText As String)
fieldMatch = fieldSplit.Match(cmdText, (kwc(selectPosition).Index +
kwc(selectPosition).Length + 1), (kwc(fromPosition).Index -
kwc(selectPosition).Index + kwc(selectPosition).Length + 1)))
If fieldMatch.Value = “*” Then
Me.dataView = Me.dataSet.Tables(Me.tableName).DefaultView
Me.useDefaultTable = True
Else
Me.useDefaultTable = False
If Me.dataSet.Tables.Contains(Me.tempTableName) Then
Me.dataSet.Tables.Remove(Me.tempTableName)
End If
Dim table As FCLData.DataTable = New FCLData.DataTable(Me.tempTableName)
While fieldMatch.Success
If Me.dataSet.Tables(Me.tableName).Columns.Contains(fieldMatch.Value) Then
Dim col As FCLData.DataColumn =
dataSet.Tables(tableName).Columns(fieldMatch.Value)
table.Columns.Add(New FCLData.DataColumn(col.ColumnName,
col.DataType))
fieldMatch = fieldMatch.NextMatch
Else
Throw New ArgumentException(“Invalid column name”)
End If
Search WWH ::




Custom Search