|
-
Oct 15th, 2004, 09:15 AM
#1
Thread Starter
New Member
Can't connect to database [resolved]
Hi guys and gals!
I was wondering if anyone could help me? I'm using a book called "Karl Moore's Visual Basic .NET: The Tutorials" and getting on great with it..... but for one thing!
I can't seem to connect to the database I need to use (I know it works cos I can manually add data to it)
I'm using the following connection string, as prescribed by the book:
Dim objConnection As New SqlClient.SqlConnection _
("server=.;database=KeepFit;trusted_connection=true")
Whenever I try to run this, I just get an error message saying SQL Server does not exist or access denied.
Any help you can give would be very very much appreciated
Thanks
Last edited by d1lb3rt; Oct 15th, 2004 at 11:44 AM.
-
Oct 15th, 2004, 09:20 AM
#2
Dim objConnection As New SqlClient.SqlConnection _
("server=.;database=KeepFit;trusted_connection=true")
well unless the name of the SQL Server is "." I can see exactly why this wouldn't work.
-
Oct 15th, 2004, 09:36 AM
#3
Thread Starter
New Member
the dot signifies that the instance of the server is on the local machine, as quoted in Karl's book. When I set a breakpoint, I can see it is looking at the right place. Even when I substitute the full server name, I get the same message.
-
Oct 15th, 2004, 09:41 AM
#4
Hi
Try removing trusted_connection=False and add the username and password in the connection string.
Regards
Jorge
"The dark side clouds everything. Impossible to see the future is."
-
Oct 15th, 2004, 09:47 AM
#5
Thread Starter
New Member
Thanks for the suggestion, but I don't have a user name or password. I'm not using the full SQL server, it's just MSDE that comes with VS.NET - unless you know of what the default user name and password are? If it helps, my database was set up using windows security rather than a specific uname and pwd.
-
Oct 15th, 2004, 09:57 AM
#6
did you name the instance of the MSDE when you installed it?
-
Oct 15th, 2004, 10:01 AM
#7
Thread Starter
New Member
I didn't get the opportunity - it just went in as potter\netsdk
-
Oct 15th, 2004, 10:36 AM
#8
maybe you should add a SQLConnection control onto a form and setup a connection that way... the system will do a lot of the work for you.. then once you have made a successful connection, you can look at the connection string it is using, and use that in your code.. the SQLConnection object can be found under the data tab in the toolbox
-
Oct 15th, 2004, 11:43 AM
#9
Thread Starter
New Member
[solved]
Managed to fix it with the help of another web site - I had to manually grant myself access to the database before I could do anytyhing.
Thanks for all your help guys!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|