add table

Dim table As DataTable = New DataTable("jhreport")
            Dim column As DataColumn
            column = New DataColumn()
            column.ColumnName = "id"
            table.Columns.Add(column)

            Dim row As DataRow
            row = table.NewRow()
            row("id") = "SqlError"
            table.Rows.Add(row)

            ds.Tables.Add(table)

//--------------------------


If Me.rtboxSQL.Text.Trim = Nothing Then
                MsgBox("请输入SQL语句", MsgBoxStyle.Information, "系统提示:")
                Return
            End If
            Dim dt As DataTable
            dt = _ws.GetReportBySQL(Me.rtboxSQL.Text.Trim).Tables("jhreport")
            If dt.Rows.Count > 0 Then
                If dt.Rows(0)(0).ToString = "SqlError" Then
                    MsgBox("SQL语句输入有误!", MsgBoxStyle.Information, "系统提示:")
                    Return
                Else
                    Me.RefreshData(dt)      '绑定显示
                End If
            Else
                Me.RefreshData(dt)          '绑定显示
            End If

你可能感兴趣的:(table)