我现在把正确的代码贴出来 ,供大家参考
Imports System.Data
Imports System.Data.SqlClient
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As SqlConnection
Dim str As String
Dim ds As New DataSet
Dim coldrow As DataRowCollection
Dim drow As DataRow
Dim init As Integer
str = "Data Source=.;Initial Catalog=sheet;Integrated Security=true;"
con = New SqlConnection(str)
con.Open()
Dim ada As New SqlDataAdapter("select * from test", con)
ada.Fill(ds, "test")
Dim dtable As New DataTable
dtable = ds.Tables("test")
coldrow = dtable.Rows
For init = 0 To coldrow.Count - 1
drow = coldrow.Item(init)
lbl.Text = lbl.Text & "id" & drow(0)
lbl.Text = lbl.Text & "dealer" & drow(1)
lbl.Text = lbl.Text & "areaBig" & drow(2)
lbl.Text = lbl.Text & "areaSmall" & drow(3) & "<br>"
Next
dtable.AcceptChanges()
gv.DataSource = ds.Tables("test").DefaultView
gv.DataBind()
con.Close()
con = Nothing
End Sub