Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to connect to a db in sql 2000 using vs2010
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

9 Posts

Posted - 01/16/2012 :  07:58:24  Show Profile  Reply with Quote
hi All,
Hope you are doing fine. I am a vb beginner and currently using vs2010. I have an application using sql server 2000 and I am trying to develop something to access data from that database. First of all, I am trying to connect to a database there which I can't. Below is my code. I would be very grateful if anyone of u can advise. To manage the databases, sql server enterprise manager is used. I have noticed there that there is no instance name (Is that normal). Windows authentication is being used to log in.

Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim objconnection As SqlConnection = New SqlConnection("server=;database=databasename;Integrated Security=True;")

Public Sub Connect2Database()
MsgBox("You are connected")
MsgBox("You are not connected")

End Try
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


End Sub
End Class

Result: "You are not connected"

Flowing Fount of Yak Knowledge

5155 Posts

Posted - 01/16/2012 :  08:22:42  Show Profile  Reply with Quote
Your code looks ok to me, but I am not very familiar with SQL 2000, so I could be missing something as well. Check out this page and use one of the formats listed there for connection string. Also, make sure that you can connect to the database on using enterprise manager, or at the very least ping the server from your computer. Is the server up and running?
Go to Top of Page

Starting Member

9 Posts

Posted - 01/17/2012 :  01:29:15  Show Profile  Reply with Quote
Dear Sunitabeck,
thank you for your reply. The server is up and running. I can ping server as well. I have tried the format you mentioned but in vain.What else can you suggest?
Go to Top of Page

Starting Member

1 Posts

Posted - 01/17/2012 :  07:38:04  Show Profile  Reply with Quote
If you want connect front-end visual studio 2010 to SQL Server 2000 then you must write a connection string go to .NET platform then pass name of database.

[url=]Denver Paper Shredding[/url]
[url=]Industrial Paper Shredder[/url]
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000