秸秆禁烧 三年:不能加载数据

来源:百度文库 编辑:高考问答 时间:2024/05/13 14:12:41
如下面代码所示,用VB.NET做网页时出现问题
:<script language="VB" runat="server">
Dim strConnection As String
Sub Page_Load(Src As Object, E As EventArgs)
Label1.Text="fdsGFDGFGFGGSDFGf"
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Inetpub\wwwroot\Nettest\DataBase\Examination.mdb"
If Session("AdminPass") <> True Then Response.Redirect("../AdministratorLogin.aspx")
If Not IsPostBack Then Grid_Bind()
End Sub

Function CreateDataView() As DataView
Dim SelectCommand As String = "Select * From StudentInfo"

Dim Myadapter As OleDbDataAdapter = _
New OleDbDataAdapter(SelectCommand,strConnection)
Dim DS As DataSet = New DataSet()
Myadapter.Fill(DS,"StudentInfo")

CreateDataView = DS.Tables("StudentInfo").DefaultView
End Function

'数据绑定
Sub Grid_Bind()
StudentInfo.DataSource = CreateDataView()
StudentInfo.DataBind()
End Sub

'页面导航
Sub Page_Changed(Src As Object, E As DataGridPageChangedEventArgs)
Grid_Bind
End Sub
</script>
当用DataGrid进行绑定时始终看不到数据,数据库路径应该没有问题把,反正运行时没有报错,但就是没有数据显示,还有几个页面问题相同,不知道是什么原因