dine dine - 2 months ago 11
Vb.net Question

From Access to Textbox

I am beginner for VB.NET. i am trying to retrieve data from Access to clsi.Textbox. i get an syntax error when i run this code.

Syntax error (comma) in query expression 'Roomtype = Classic AND aDate=Monday, August 22, 2016'.

please help

below is my code.

FIRSTDATE is date and time picker


cmd1 = New OleDbCommand("select Rate1P from list where Roomtype = " & GroupBox1.Text & " AND aDate=" & FIRSTDATE.Text & "", cnn)

clsi.Text = cmd1.ExecuteNonQuery



Try calling the Value property of the DateTimePicker, not the Text property. Replace FIRSTDATE.Text with FIRSTDATE.Value

Public Class Form1
    Public Sub New()

        ' This call is required by the designer.

        ' Add any initialization after the InitializeComponent() call.
        dtp.Value = Date.Now
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub
End Class