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

Declaration Expected

P: n/a
I've an error in code I got from a walkthrough that should work just fine. I
added a reference to DMO that shows up in the references properly. The Dim
line shows no errors but the initialized object shows an 'Declaration
Expected' error. What could be happening?

Dim oSQLServer As New SQLDMO.SQLServer
oSQLServer.Connect("(local)", "myServer", "myPassword")
--
Steve King
Jan 23 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Dim oSQLServer As New SQLDMO.SQLServerClass
--
Milosz Skalecki
MCP, MCAD
"Steve King" wrote:
I've an error in code I got from a walkthrough that should work just fine. I
added a reference to DMO that shows up in the references properly. The Dim
line shows no errors but the initialized object shows an 'Declaration
Expected' error. What could be happening?

Dim oSQLServer As New SQLDMO.SQLServer
oSQLServer.Connect("(local)", "myServer", "myPassword")
--
Steve King

Jan 23 '06 #2

P: n/a
I immediately tried your recommendation. It resulted in exactly the same
problem. After typing the SQLDMO., I am prompted with the class members and
both SQLServer and SQLServerClass are visible. Selecting either of these
seems to work on the Dim line but gives me the error when I try to use the
object. I'm using VB.NET 2003 from VS.
--
Steve King
"Milosz Skalecki" wrote:
Dim oSQLServer As New SQLDMO.SQLServerClass
--
Milosz Skalecki
MCP, MCAD
"Steve King" wrote:
I've an error in code I got from a walkthrough that should work just fine. I
added a reference to DMO that shows up in the references properly. The Dim
line shows no errors but the initialized object shows an 'Declaration
Expected' error. What could be happening?

Dim oSQLServer As New SQLDMO.SQLServer
oSQLServer.Connect("(local)", "myServer", "myPassword")
--
Steve King

Jan 23 '06 #3

P: n/a
It's working in my VS. Delete SQLDMO reference and add it again. Have u got
option strict set to on?

--
Milosz Skalecki
MCP, MCAD
"Steve King" wrote:
I immediately tried your recommendation. It resulted in exactly the same
problem. After typing the SQLDMO., I am prompted with the class members and
both SQLServer and SQLServerClass are visible. Selecting either of these
seems to work on the Dim line but gives me the error when I try to use the
object. I'm using VB.NET 2003 from VS.
--
Steve King
"Milosz Skalecki" wrote:
Dim oSQLServer As New SQLDMO.SQLServerClass
--
Milosz Skalecki
MCP, MCAD
"Steve King" wrote:
I've an error in code I got from a walkthrough that should work just fine. I
added a reference to DMO that shows up in the references properly. The Dim
line shows no errors but the initialized object shows an 'Declaration
Expected' error. What could be happening?

Dim oSQLServer As New SQLDMO.SQLServer
oSQLServer.Connect("(local)", "myServer", "myPassword")
--
Steve King

Jan 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.