Real basic problem. Can't open a SQL connection

M

Michael Hesse

Hi,

I am trying to go from VB to ASP. The following code works perfectly in VB.

Dim cn as New SqlConnection
Dim sConnect as String = "workstation id=VECTRA\mh;data
source=VECTRA;Initial Catalog=Items; Integrated Security=SSPI"
cn.ConnectionString=sConnect
cn.Open()

When I past the same code into ASP.NET, I get this error:

Login failed for user 'VECTRA\ASPNET'.

Can someone help me?

Thanks,

Michael
 
M

Marina

The message says that login failed for 'VECTRA\ASPNET' .

This means that ASPNET on machine VECTRA does not have rights to the
database. So you need to give it rights.
 
M

Michael Hesse

I didn't realize I needed to create a special user for ASP.Net.

Thanks so much.

Michael
 
M

Michael Hesse

Hi Curt,

Thanks for responding.

Apparently the connection string wasn't the problem, but I would still like to understand your suggestion.

Title: Connection Strings
Comments: Here is a simple/easy way to create a connection string to your databases when you can't quite remember the syntax.
Code: Step 1:
Open a folder on your hard drive, any folder will do.

What do I open it with? With the Windows Explorer? From within the .NET IPE?

When I try both of these, double-clicking just opens the file in Notepad.

Could you give me a bit more information? Thanks.

Michael
 
C

Curt_C [MVP]

Title: Connection Strings
Comments: Here is a simple/easy way to create a connection string to
your databases when you can't quite remember the syntax.
Code: Step 1:
Open a folder on your hard drive, any folder will do.

What do I open it with? With the Windows Explorer? From within the
..NET IPE?
-- Windows Explorer

When I try both of these, double-clicking just opens the file in
Notepad.
-- make sure the file is a .UDL, not a .UDL.TXT

Could you give me a bit more information? Thanks.
-- basically all it does is step you through creating a connection string.
You can get more info like this from www.aspfaq.com and even
www.connectionstrings.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top