468,458 Members | 1,827 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,458 developers. It's quick & easy.

Incorrect syntax near keyword 'ON' ????

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
2 1730

"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
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.

Similar topics

1 post views Thread by Jeff Magouirk | last post: by
11 posts views Thread by Mark Findlay | last post: by
2 posts views Thread by ielmrani via SQLMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.