Home > Software engineering >  Vb programming why search access data display blank, program debugging without mistakes
Vb programming why search access data display blank, program debugging without mistakes

Time:09-20

Vb programming why search access data display blank, program debugging error not
Program content is as follows:
 Private Sub Command1_Click () 
Dim strSql As String
If Text1. Text & lt;> "" Then
Adodc1. You. Close
If Val (Text1. Text) & gt; 0 Then
StrSql="select * from table1 where num=" & amp; Trim (Text1. Text)
The Else
StrSql="select * from table1 where name='" & amp; Trim (Text1. Text) & amp; "'
"End the If
Adodc1.Com mandType=adCmdText
Adodc1. You. Open strSql
The Set DataGrid1. The DataSource=Adodc1
The Else
The Set DataGrid1. The DataSource=Nothing
End the If
End Sub

Where is the problem? Why shows the blank in the search after the plugin

CodePudding user response:

This is a PE teacher to teach programming?
Don't direct operation Adodc1. You, can affect the function of normal!!!!!!

CodePudding user response:

Posting more than N a problem, that is a bit of a psychopath?

This section was not popular, is also worried about post "submerged"!!!!!!

CodePudding user response:

Fenqing never lack of presence!

CodePudding user response:

 Private Sub Command1_Click () 

Dim strSql As String
If Text1. Text & lt;> "" Then
If Val (Text1. Text) & gt; 0 Then
StrSql="select * from table1 where num=" & amp; Trim (Text1. Text)
The Else
StrSql="select * from table1 where [name]='" & amp; Trim (Text1. Text) & amp; "'
"End the If

Adodc1.Com mandType=adCmdText
Adodc1. RecordSource strSql=
The Set DataGrid1. The DataSource=Adodc1
Adodc1. Refresh
The Else
The Set DataGrid1. The DataSource=Nothing
End the If

End Sub

Private Sub Form_Load ()
Adodc1. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source=[your database file path and file name]. Persist Security Info=False "
End Sub
  • Related