|
-
Jul 8th, 2002, 06:15 AM
#1
Thread Starter
Addicted Member
DBNull data type to string
I created a DataSet fro a query and populate a table with its values. But when a field contains NULL value I receive an error message about conversion DBNull data type to string. Can anyone help me how to solve this problem?
The code as follows:
ByVal strTableName As String)
Dim r As TableRow
Dim c As TableCell
Dim myTable As DataTable
Dim myRow As DataRow
Dim myColumn As DataColumn
Dim strTemp As String
' For each table in the DataSet, print the row values.
myTable = myDataSet.Tables(strTableName)
For Each myRow In myTable.Rows
r = New TableRow()
For Each myColumn In myTable.Columns
c = New TableCell()
strTemp = myRow(myColumn)
c.Controls.Add(New LiteralControl(strTemp))
r.Cells.Add(c)
Next myColumn
Table1.Rows.Add(r)
Next myRow
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|