Home > Software engineering >  For a great god why executive conn. Open vb the entire software is directly out of the race??
For a great god why executive conn. Open vb the entire software is directly out of the race??

Time:09-22

 Private Sub TitleCom_Click () 
Dim conn As New ADODB. Connection
Dim the rs As New ADODB. You
Dim total As Integer
Conn. The ConnectionString="Provider=Microsoft. ACE. The OLEDB. 12.0. Data Source="+ App. Path +" \ total table. Accdb
"Conn. Open
Set the rs. The ActiveConnection=conn
Rs. Open the "SELECT * FROM table 1"
Total=rs. RecordCount
Rs. MoveFirst
QuesLab. Caption=rs. Fields (1)
AnswLab. Caption=rs. Fields (5)
TotalLab. Caption=total
Rs. Close
Conn. Close
Set the rs=Nothing
Set the conn=Nothing


End Sub

CodePudding user response:

Code debugging found directly out of the space may be the cause of some code to do not exist,
The following code tests pass, VB6.0 by use of Windows 8.1 (64)
 Private Sub Command13_Click () 
Dim conn As New ADODB. Connection
Dim the rs As New ADODB. You
Dim total As Integer
Dim SQL
'the conn. The ConnectionString="Provider=Microsoft. ACE. The OLEDB. 12.0; Data Source="+ App. Path +" \ total table. Accdb
"SQL="select * from guzhang_sj" 'where madanhao=' 1 '
"Conn. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source="& amp; App. The Path & amp; "\ wd. MDB; Persist Security Info=False "
Conn. Open
Set the rs. The ActiveConnection=conn
Rs. CursorLocation=adUseClient
Rs. The Open SQL, conn, adOpenDynamic adLockOptimistic
'the rs. Open the "SELECT * FROM table 1"
Total=rs. RecordCount
Rs. MoveFirst
Text2=total
QuesLab. Caption=rs. Fields (1)
AnswLab. Caption=rs. Fields (2)
'TotalLab. Caption=total
Rs. Close
Conn. Close
Set the rs=Nothing
End Sub

CodePudding user response:

Code debugging found directly exit could be the cause of some code to control does not exist,

CodePudding user response:

In a 64 - bit Windows:
64 exe and DLL in the directory c: \ Windows \ sys tem32 directory.
32 bit exe and DLL in the directory c: \ Windows \ sys wow64 directory.
So pay attention to:
In win64 system registered under 32-bit ocx DLL to 32 ocx or copy the DLL to the c: \ Windows \ syswow64 \ directory,
And registered to c: \ Windows \ syswow64 \ regsvr32 XXXXXXX ocx or DLL
Under win64 a system set up 32-bit programs use a database alias to c: \ Windows \ \ syswow64 \ cliconfg exe
Under win64 a system set up a 32-bit application system DSN to c: \ Windows \ \ syswow64 \ odbcad32 exe

CodePudding user response:

Quit because you didn't do error handling directly!
Error reason is that you don't have to install Microsoft Access 2010 database engine can release the package, or Access is 64,

CodePudding user response:

Conn. The ConnectionString="Provider=Microsoft. ACE. The OLEDB. 12.0. Data Source="+ App. Path +" \ total table. Accdb
"Is amended as:
Conn. The ConnectionString="Provider=Microsoft. ACE. The OLEDB. 12.0. Data Source="& amp; App. The Path & amp; "\ total table. Accdb; The Jet OLEDB: Database Password=;"
Test no problem,
  • Related