From textbox1 input query value after press for the query, the results from label2 output
Imports System. Data. The OleDb
Public Class Form1
Private Sub Button1_Click (sender As System. Object, e the As System. EventArgs) Handles for. Click
'define a baiOLEDB connected and instantiate it
Dim con As New OleDbConnection
'to define an OLEDB command and instantiate he
Dim CMD As New OleDbCommand
'define a OLEDBReader method to read the database
Dim the Dr As OleDbDataReader
'initialize con connection properties, use the OLEDB mode, data source is:
Con. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source=E: \ \ \ database dictionary project dic MDB
"'to open the OLEDB data connection
Con. The Open ()
'initialize the OLEDB command connection properties for con
CMD. Connection=con
'initialize the OLEDB command statement
Cmd.Com mandText="select keyss from dic where ID=" & amp; TextBox1. Text & amp; "
"Dr=CMD. ExecuteReader ()
If Dr. Read () Then
Label2. Text=Dr (0)
End the If
Dr. Close ()
Con. The Close ()
End sub
Private Sub Form1_Load (sender As Object, As EventArgs e) Handles MyBase. Load
End Sub
The End of the Class
When running the query error "Dr CMD=ExecuteReader () at least one parameter is not specified values"
Why?