Jump to content
Xtreme .Net Talk

Need help with ASP.NET with ADO.NET and SQL SErver 2000


Recommended Posts

Posted

I have an IIS server running on my WinXP. I also recently installed a SQL Server 2000 on my machine. Now here's the problem. ASP.NET pages work just fine on my machine if I'm not talking to my SQL Server Database. But when I do try to connect to my SQL Server 2000 I get an error:

 

This is the String that I'm using to connect:

SqlConnection sqlConn = new SqlConnection("server=BAQIR_MACHINE\\BAQIR_DB;" + "Integrated Security=SSPI;Initial Catalog=Baqir_Test_Data");

 

And this is the error that I get:

Server Error in '/BaqirADO' Application.

--------------------------------------------------------------------------------

 

Login failed for user 'BAQIR_MACHINE\ASPNET'.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'BAQIR_MACHINE\ASPNET'

(By the way, I checked and I do have an ASPNET account on my machine)

(Pointing to this line of code)

sqlConn.Open();

 

 

-------------------------------------------------------------------------------------------------------------------

I then tried to connect with this line:

SqlConnection sqlConn = new SqlConnection ("server=localhost;database=Baqir_Test_Data;uid=sa;pwd=;");

 

 

And this is the error that I get:

Server Error in '/BaqirADO' Application.

--------------------------------------------------------------------------------

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

 

Can someone help me out here. Am I doing something wrong here, or do I have to configure some setting in my computer.

 

Thanks In Advance

la grecque
Posted

That works, thanks.

 

But in the following case?:

I have a web server (IIS) and a SQL server 2000 and each

of these live on a different box in our network. I want

to let my asp.net app talk to my SQL server box.I f I understand, what I need to do for the separate boxes

to talk, is set up a login on my SQL server database for

the ASPNET account. Does my network admin have to create an

account like this for me? What do they use for the

password? An account by this name does not currently

exist. The web server is running Win2K

server and the SQL box is the Enterprise Edition runnning

on WinXP pro.

la grecque
Posted
You dont need to create an ASPNET account, in fact, i wouldnt create one with that name (security reasons). Just create a user with access to the database and use that username and password in the connection string.
..::[ kleptos ]::..
Posted

I created the user APN with blank password and I gave him all rights, I use the following connectionstring but I take server error in application...

 

<add key="SqlConnection1.ConnectionString" value="Network Library=DBMSSOCN;Data Source=APN-TC2110,1433;Initial Catalog=Netgestion;UserID=APN;Password=;Persist Security Info=false;Workstation ID=APN-e800;Connect Timeout=30" />

 

I'm so confused...

la grecque
Posted

I wrote an ASP Application. I put the connection string you propose.

I wanted to install this application in another machine X. This machine X hasn't VS .NET, SQL Server etc.

I installed IIS, .NET Framework, MDAC 2.6, MDAC 2.7 SP1.

I wanted my application installed on the machine X to communicate with a database of SQL Server of the machine Y.

I created a user with access to this database.

It doen't work

 

Sorry but I'm a beginner... and the things are so difficult for me

la grecque
Posted

Server Error in abc Application

 

Autorisation SELECT refusee sur l'objet "PERSONNEL", base de donnees "NetGestion", proprietaire dbo

 

System.Data.SqlClient.SqlException

la grecque
Posted
Looking at that error, the user in which is accessing the table (the one in the connection string) doesnt have select permissions on that table.
..::[ kleptos ]::..
Posted

I gave user all permissions.

The error I get is the same when I first ran the application on my machine, locally(web server, sql server, vs net all in my machine), and the solution came with the creation of an ASPNET account.

But here, with the intranet...

 

I don't know.

 

With my Windows application Ididn't have problems, I was connected to the database and I took the data I wanted. With the same connection string

 

Thanks anyway for the help and the interest

la grecque
Posted

I found the problem....

At the secyrity tab of the SQL Server, I chose Authentification:

SQL and Windows (mixte)....

I didn't know the properties of their SQL Server...

 

I'm really sorry...

la grecque

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...