我正在进行一项任务,我必须使用VB.net和Access数据库才能建立书店。其中一个要求是我必须制作一个包含书名和客户名称的表格,并在标题和客户名称上添加超链接,将其重定向到新页面。我有表工作,但我无法添加超链接到表中的一个列。还有一个搜索功能,我必须打印价格范围之间的所有书籍(例如20美元<价格<= 30美元)我有单选按钮设置,但我无法进行实际搜索并获得良好的价值。我的代码如下:
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Public Class CustomerSearching
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
RadioButton1.Visible = False
RadioButton2.Visible = False
RadioButton3.Visible = False
RadioButton4.Visible = False
RadioButton5.Visible = False
End Sub
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=" + Server.MapPath("~/bookstore.accdb"))
conn.Open()
End Sub
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Response.Redirect("Customer.aspx")
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OleDb.12.0;Data Source=" + Server.MapPath("~/bookstore.accdb"))
RadioButton1.Visible = True
RadioButton2.Visible = True
RadioButton3.Visible = True
RadioButton4.Visible = True
RadioButton5.Visible = True
If (RadioButton1.Checked) Then
conn.Open()
Dim sql As String = "SELECT * FROM books WHERE price < $10.00"
Dim dbcomm As New OleDb.OleDbCommand(sql, conn)
Dim dbread = dbcomm.ExecuteReader()
bookSearching.DataSource = dbread
bookSearching.DataBind()
dbread.Close()
conn.Close()
End If
End Sub
Protected Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.CheckedChanged
End Sub
End Class
对于超链接,我使用vb选项来设计和拖动sqlDataSource和gridview,并将两者与我的bookstore.accdb文件链接在一起。非常感谢您的帮助。非常感谢。