Declaration Expected

S

Simon Harris

Hi All,

I'm trying to the the following code working in VS.Net, when I add the lines
noted with '<<<<<' VS tells me declaration is expected for
'SPDOleDbConnection'

Public Class DBConnect
Dim configurationAppSettings As System.Configuration.AppSettingsReader =
New System.Configuration.AppSettingsReader
Dim SPDOleDbConnection As New OleDb.OleDbConnection
SPDOleDbConnection.ConnectionString =
CType(configurationAppSettings.GetValue("OleDbConnection1.ConnectionString",
GetType(System.String)), String) <<<<<
SPDOleDbConnection.Open() <<<<<
Dim OleDbCommand As New OleDb.OleDbCommand
End Class

AFAIK, if I've declared SPDOleDbConnection, then I can reference its
properties on subsequent lines?

Regards,
Simon.
 
S

Simon Harris

Sorry - Should have mentioned that the code is not complete yet, just having
problems on the lines marked.
 
G

Guest

Hi Simon,
Keep the code inside a method and your problem should resolve.
regards
srini
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top