Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ashley.s
Starting Member
9 Posts |
Posted - 2012-01-16 : 07:58:24
|
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.DataImports System.Data.SqlClientPublic Class Form1Dim objconnection As SqlConnection = New SqlConnection("server=192.168.0.9;database=databasename;Integrated Security=True;")Public Sub Connect2Database()Tryobjconnection.Open()MsgBox("You are connected")objconnection.Close()CatchMsgBox("You are not connected")End TryEnd SubPrivate Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadConnect2Database()End SubEnd ClassResult: "You are not connected" |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-01-16 : 08:22:42
|
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. http://www.connectionstrings.com/sql-server Also, make sure that you can connect to the database on 192.168.0.9 using enterprise manager, or at the very least ping the server from your computer. Is the server up and running? |
|
|
ashley.s
Starting Member
9 Posts |
Posted - 2012-01-17 : 01:29:15
|
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? |
|
|
xpresshred11
Starting Member
1 Post |
Posted - 2012-01-17 : 07:38:04
|
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=http://www.xpresshred.com/]Denver Paper Shredding[/url][url=http://www.xpresshred.com/]Industrial Paper Shredder[/url] |
|
|
|
|
|