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

Incorrect syntax near keyword 'ON' ????

P: n/a
Jon
hi,
i was trying to create a DB in a SQL Server.
but when i try to connect it with :

Dim conn As SqlConnection = New SqlConnection("Initial Catalog=master; " & _
"Data Source=SERVER-MACHINE;" & _
"UID=sa; PWD=;")

It gave me this SQLexception "Incorrect syntax near keyword 'ON"
which i have no idea what it means............

but when i tried to remove the UID and PWD
it saids "Login fails for user:(null). Reason: Not associated with a trusted
SQL Server connection".

Any help is appreciated......many thanks.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:90**********************************@microsof t.com...
hi,
i was trying to create a DB in a SQL Server.
but when i try to connect it with :

Dim conn As SqlConnection = New SqlConnection("Initial Catalog=master; " &
_
"Data Source=SERVER-MACHINE;"
& _
"UID=sa; PWD=;")

It gave me this SQLexception "Incorrect syntax near keyword 'ON"
which i have no idea what it means............

but when i tried to remove the UID and PWD
it saids "Login fails for user:(null). Reason: Not associated with a
trusted
SQL Server connection".

Any help is appreciated......many thanks.


Sounds to me the problem is located in one of your SQL strings. Did you set
a SqlCommand object first?

Dave
Nov 21 '05 #2

P: n/a
Jon,

I don't know if there is a sequence needed, however normally is the
datasource where the database is "ON" first named.

http://www.connectionstrings.com/

I hope this helps,

Cor
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.