473,416 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

easy sql connection

Can anyone please help me simply connect to northwind? Maybe some logical
steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one
below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication
windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()
Nov 19 '05 #1
9 1321
Check with http://www.connectionstrings.com/

regards
Joyjit

"AccessStarters" <da**********@canada.com> wrote in message
news:ScLzd.10044$Y72.1752@edtnps91...
Can anyone please help me simply connect to northwind? Maybe some logical
steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication
windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()

Nov 19 '05 #2
AccessStarters wrote:
Can anyone please help me simply connect to northwind? Maybe some
logical steps that I may be missing?

I have tried many tutorials and they all give similar connections to
the one below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")


Use
Data Source=(local)
instead of
Data Source=localhost

--

Edge
Nov 19 '05 #3
Hi Jill,

Do you have a named instance of SQL Server or default instance? Do you have
it at your local machine? Do you have privilges to access that instance and
the Northwind database?

"AccessStarters" wrote:
Can anyone please help me simply connect to northwind? Maybe some logical
steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one
below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication
windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()

Nov 19 '05 #4
Not sure what you mean here
1. I have MSSQLSERVER as a service which is started. (don't know how to tell
if named or default instance?)
2. I can test it successfully from VStudio Server Explorer and is
successful.
3. I can show all say employeee recs from the enterprise manager
4. have tried Data Source=(local) instead of Data Source=localhost
5. have tried database instead of Initial Catalog
6. On my local machine (is called HOME). The sql server is called (LOCAL)
within a server group
7. I log on as Administrator and wouldn't know how to tell if I have
privilages to access an instance of Northwind.
8. My IIS works as can connect when doing tutorials with a jet Access
connection
9. i have win2000, use ie6, use zone alarm which have tried off and on.
10. Am curious to know if you copied and pasted the code below that it does
actually work - else I am completely confused.

Many thanks- hope the above helps...

"tHE LoRd T" <tH*****@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
Hi Jill,

Do you have a named instance of SQL Server or default instance? Do you have it at your local machine? Do you have privilges to access that instance and the Northwind database?

"AccessStarters" wrote:
Can anyone please help me simply connect to northwind? Maybe some logical steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()

Nov 19 '05 #5
Thanks Joyjit
have been there and tried a few variations. Still at a loss.
Please see my reply to "TheLord" link as gave more parameters.
Appreciated!!

"Joyjit Mukherjee" <jo**************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Check with http://www.connectionstrings.com/

regards
Joyjit

"AccessStarters" <da**********@canada.com> wrote in message
news:ScLzd.10044$Y72.1752@edtnps91...
Can anyone please help me simply connect to northwind? Maybe some logical steps that I may be missing?

I have tried many tutorials and they all give similar connections to the

one
below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at

System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()


Nov 19 '05 #6
Thanks Edge
Still at a loss.
Please see my reply to "TheLord" link as gave more parameters.
Appreciated!!

"Edge" <ed**@edge.com> wrote in message
news:O$****************@TK2MSFTNGP15.phx.gbl...
AccessStarters wrote:
Can anyone please help me simply connect to northwind? Maybe some
logical steps that I may be missing?

I have tried many tutorials and they all give similar connections to
the one below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")


Use
Data Source=(local)
instead of
Data Source=localhost

--

Edge

Nov 19 '05 #7
Hi,

Try add the ASPNET user account to the database Northwind users, (i.e give
the ASPNET user account privileges to access your SQL Server and the
Northwind db).

Please keep me updated.

"AccessStarters" wrote:
Can anyone please help me simply connect to northwind? Maybe some logical
steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one
below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication
windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()

Nov 19 '05 #8
Hello AccessStarters,

Yes I have tried it, just add the ASPNET user account (in your case
HOME\ASPNET user) to the Northwind users on your SQL Server and it will
connect successully; because you are using your code from ASP.NET wich uses
the ASPNET user account not the user account you use to log to Windows.

Please keep me updated :)

"AccessStarters" wrote:
Can anyone please help me simply connect to northwind? Maybe some logical
steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one
below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication
windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec
tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()

Nov 19 '05 #9
that was it
thank you most kindly!!!
"tHE LoRd T" <tH*****@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
Hello AccessStarters,

Yes I have tried it, just add the ASPNET user account (in your case
HOME\ASPNET user) to the Northwind users on your SQL Server and it will
connect successully; because you are using your code from ASP.NET wich uses the ASPNET user account not the user account you use to log to Windows.

Please keep me updated :)

"AccessStarters" wrote:
Can anyone please help me simply connect to northwind? Maybe some logical steps that I may be missing?

I have tried many tutorials and they all give similar connections to the one below.
Dim objConnection As SqlConnection = New SqlConnection("Data
Source=localhost;Integrated Security=SSPI;" & _
"Initial
Catalog=northwind")
I still cannot get a connection with sqlserver2000 (set to authentication windows only). It is running.
TIA
Jill
Here is m entire test.aspx file (error code below too)
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>

<script language="VB" runat="server">
Sub Page_Load()
Dim strConnection as String = "Integrated Security=SSPI;"
strConnection += "Initial Catalog=Northwind;server=localhost;"
strConnection += "Persist Security Info=no;"
strConnection += "Connect Timeout=30"
data_src.text = strConnection

Dim objConnection as New SqlConnection(strConnection)

'Now we attempt to open the connection
try
objConnection.Open()
con_open.text="Connection opened successfully.<br />"
objConnection.Close()
con_close.text="Connection closed.<br />"
catch e as Exception
con_open.text="Connection failed to open.<br />"
con_close.text=e.ToString()
end try
end Sub
</script>

<html>
<body>
<h4>Testing the data connection
<asp:label id="data_src" runat="server"/></h4>
<asp:label id="con_open" runat="server"/><br />
<asp:label id="con_close" runat="server"/><br />
</body>
</html>
---------------------------------------
error message
Testing the data connection Integrated Security=SSPI;Initial
Catalog=Northwind;server=localhost;Persist Security Info=no;Connect
Timeout=30
Connection failed to open.

System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied. at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean&
isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnec tionString options, Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnection.Open() at
ASP.sql_connection_aspx.Page_Load()

Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
50
by: jbailo | last post by:
Subject: dotnet is a farce. You know, I was always impressed with the way one could write a http program with c# or java. To me, it showed how 'superior' these languages are because they made...
11
by: Sebastian Boeck | last post by:
Hello, whats the most simple way to insert the same value into 2 colums of the same table? My table is looking like this: Spalte | Typ | Attribute...
3
by: Marty | last post by:
Hi, I have this DLL made with VB.NET made as a Class Library project. I know this is managed code. I have my other made with VC++.NET, unmanaged code. The point is that I want to use...
3
by: BY | last post by:
Hi, This is my code and it works fine... Dim Conn As OleDb.OleDbConnection Dim Cmd As OleDb.OleDbCommand Dim Reader As OleDb.OleDbDataReader Dim i As Integer Conn = New...
10
by: cj | last post by:
I have lots of tables to copy from one server to another. The new tables have been created to match the old ones. I practiced with one table. I created the select command (select * from tableA)...
14
by: Naraendirakumar R.R. | last post by:
I have a client in the healthcare industry who would prefer to store the connection string in a centralized location in their Active Directory repository. Has anybody done this? What has your...
4
by: Rick Stevens | last post by:
I am not an access expert, could anyone tell me if the following would be easy to do?? I receive emails from a specific email address, that advise me if a specific piece of equipment my company...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.