[問題] ASP讀取資料庫的問題

看板Web_Design作者 (SOPHIE)時間19年前 (2006/06/17 17:37), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我目前在用ASP一個網頁 而資料庫是使用ACCESS 但是目前出現當我資料庫裡面的資料讀完之後 我的網頁就會顯示DBNULL 我沒有終止程式繼續讀取資料庫 請教各位高手 這個地方要怎麼解決才好呢? Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label6.Text = Session("name") Dim con As New System.Data.OleDb.OleDbConnection con.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & "data source=" & Server.MapPath("db1.mdb") con.Open() Dim datakkk As New System.Data.OleDb.OleDbDataAdapter("select * from 題庫;", con) Dim sqlcb As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(datakkk) Dim dataset As New DataSet datakkk.Fill(dataset, "題庫") con.Close() Dim datatable As New DataTable datatable = dataset.Tables("題庫") Dim t, w, a As Integer Dim q, j As Integer For q = 0 To w For t = Session("q") + 1 To datatable.Rows.Count - 1 If Session("name") = datatable.Rows(t).Item(10) Then Label1.Text = datatable.Rows(t).Item(1) Label2.Text = datatable.Rows(t).Item(2) Label3.Text = datatable.Rows(t).Item(3) Label4.Text = datatable.Rows(t).Item(4) Label5.Text = datatable.Rows(t).Item(5) For i = 0 To 3 If RadioButtonList1.Items.Item(i).Selected = True Then Session("sum") = Session("sum") + datatable.Rows(Session("q")).Item(i + 6) End If Next Exit For End If Next Session("q") = Session("q") + 1 w = Session("q") Next Response.Write(Session("sum")) End Sub -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.170.28.165
文章代碼(AID): #14ayr9OV (Web_Design)
文章代碼(AID): #14ayr9OV (Web_Design)