File: ole_ObjAssignToNothing.vb

package info (click to toggle)
libreoffice 1%3A4.3.3-2%2Bdeb8u7~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 2,687,712 kB
  • sloc: cpp: 4,024,069; java: 364,016; xml: 216,714; ansic: 74,602; perl: 34,443; python: 30,231; yacc: 12,179; makefile: 8,973; objc: 8,923; sh: 8,742; cs: 6,594; lex: 2,218; asm: 1,472; pascal: 925; awk: 807; php: 104; csh: 40; sed: 5
file content (19 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Option VBASupport 1
Function doUnitTest( TestData as String) as String
Rem Ensure object assignment is by reference
Rem when object member is used ( as lhs )
Rem This time we are testing assigning with special Nothing
Rem keyword
Set cn = New ADODB.Connection
Dim conStr As String
conStr = "Provider=MSDASQL;Driver={Microsoft Excel Driver (*.xls)};DBQ="
conStr = conStr & TestData & "; ReadOnly=False;"
cn.Open conStr
Set objCmd = New ADODB.Command
objCmd.ActiveConnection = Nothing
if objCmd.ActiveConnection Is Nothing Then
    doUnitTest = "OK" ' no error
Else
    doUnitTest = "Fail - expected objCmd.ActiveConnection be Nothing"
End If
End Function