By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

Declaration Expected

P: n/a
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("OleDbConn ection1.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.
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sorry - Should have mentioned that the code is not complete yet, just having
problems on the lines marked.

"Simon Harris" <to***********@makes-you-fat.com> wrote in message
news:uz*************@TK2MSFTNGP12.phx.gbl...
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("OleDbConn ection1.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.

Nov 18 '05 #2

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

"Simon Harris" wrote:
Sorry - Should have mentioned that the code is not complete yet, just having
problems on the lines marked.

"Simon Harris" <to***********@makes-you-fat.com> wrote in message
news:uz*************@TK2MSFTNGP12.phx.gbl...
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("OleDbConn ection1.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.


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.