怎样直接把textbox中(时间)内容作为条件在sql中引用
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.ClickDim name As String
name = Server.MapPath("财管.mdb")
Dim lian As OleDbConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" & name)
lian.Open()
Dim sql4 As String
Dim a As Date
sql4 = "select sum(消费额) as 和 from 消费 where 时间='"textbox1.text"'"
Dim ming4 As New OleDbCommand(sql4, lian)
Dim read4 As OleDbDataReader = ming4.ExecuteReader
read4.Read()
TextBox3.Text = read4("和")
lian.Close()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Text = Today
End Sub
该段代码中sql4 = "select sum(消费额) as 和 from 消费 where 时间='"textbox1.text"'"
这一句错误,请问各位大侠怎样直接把textbox1.text的内容作为条件在sql中使用
谢谢