Home > Software engineering >  VB to connect the ACCESS database statement, CNN is always wrong> ~ <urgent seek help from a g
VB to connect the ACCESS database statement, CNN is always wrong> ~ <urgent seek help from a g

Time:12-23

Module:
 Public strclid As String 
As the New Public CNN ADODb. Connection
Public user As String
Sub main ()
CNN. Open "driver=Microsoft access driver (*. MDB); DBQ="& amp; App. The Path & amp; "\.. \ database \ enactus MDB
"The login. The Show
End Sub


Statements, always showing CNN=""
RSS. Open the "select * from the user where name='" & amp; Text1. Text & amp; "'", CNN, adOpenDynamic adLockOptimistic
Don't know where is wrong...

CodePudding user response:

'code is not complete, the estimate is no database connection calls CNN
Sub main (CNN)
CNN. Open "driver=Microsoft access driver (*. MDB); DBQ="& amp; App. The Path & amp; "\.. \ database \ enactus MDB
"End Sub 'this process must be in the module or in the current interface, otherwise the database connection will be lost,

'in the call of the database connection interface, there must be
Dim RSS As New ADODB. You 'statement
Call the main database connection (CNN) 'Call
RSS. Open the "select * from the user where name='" & amp; Text1. Text & amp; "'", CNN, adOpenDynamic adLockOptimistic
'so as not to make a mistake,
  • Related