求救高人
我的代码运行哪儿有错啊?请指正,谢谢!
代码如下:
Imports System.Data.SqlClient
Public Class Webtus1
Inherits System.Web.UI.Page
Dim StuTable As Object
Function CreateDataSet(ByVal strSQL As String, ByVal FileName As String, ByVal TableName As String) As DataSet
Dim conn As New SqlConnection()
Dim cmd As New SqlCommand()
conn.ConnectionString = " Data Source=RFTU-58C014ED1B;Initial Catalog=sqldatatjj;Integrated Security=True"
conn.Open()
cmd.Connection = conn
cmd.CommandText = strSQL
Dim objAdpt As New SqlDataAdapter(cmd)
Dim DS As New DataSet()
objAdpt.Fill(DS, TableName) '表名
CreateDataSet = DS
conn.Close()
End Function
Sub DisplayDS(ByVal DS As DataSet)
Dim i, j As Integer
Dim TabRow As TableRow = New TableRow()
Dim TabCell As TableCell
For i = 0 To DS.Tables("sqldataxss").Columns.Count - 1
TabCell = New TableCell()
TabCell.Text = DS.Tables("sqldataxss").Columns(i).ToString 't
TabRow.Cells.Add(TabCell)
Next '
StuTable.Visible = True
StuTable.Rows.Add(TabRow)
For i = 0 To DS.Tables("sqldataxss").Rows.Count - 1
TabRow = New TableRow()
For j = 0 To DS.Tables("sqldataxss").Columns.Count - 1
TabCell = New TableCell()
If DS.Tables("sqldataxss").Rows(i).IsNull(j) Then
TabCell.Text = "空值"
Else
TabCell.Text =&n