Home > Software engineering >  VB database query function
VB database query function

Time:09-16

I want to according to the order value, the contents of the query acesss database content, acesss database are as follows: (only one table mainpar)



VB to establish form1, controls adodc1 datagrid, command, text1, interface is as follows:


The corresponding code is as follows:
Private Sub Command1_Click ()
If Text1 & gt; "" Then
Adodc1. RecordSource="Select * from mainpar where the serial number='" & amp; Text1 & amp; "'
"The Else
Adodc1. RecordSource="Select * from mainpar"
End the If
End Sub

Private Sub Form_Load ()
Dim mpath $, mlink $
Mpath=App. Path
If Right (mpath, 1) & lt; & gt; "" Then mpath=mpath + ""
Mlink="Provider=Microsoft. Jet. The OLEDB. 4.0;"
Mlink=mlink + mpath "data source=" + + "jjmodel. MDB
"Adodc1. The ConnectionString=mlink
Adodc1.Com mandType=adCmdUnknown

End Sub



But after the operation showed nothing



Master to have a look, please

CodePudding user response:

Supplement, this is my example according to the book, the book content is as follows:

CodePudding user response:

Who gave analysis analysis

CodePudding user response:

The great god send speech
  • Related