fotini Posted September 10, 2003 Posted September 10, 2003 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 Quote la grecque
Moderators Robby Posted September 10, 2003 Moderators Posted September 10, 2003 you need to add ASPNET as a user. Quote Visit...Bassic Software
fotini Posted September 10, 2003 Author Posted September 10, 2003 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. Quote la grecque
fotini Posted September 10, 2003 Author Posted September 10, 2003 .NET Framework is not installed on the machine where SQL Server is so there is not an aspnet account... Quote la grecque
kleptos Posted September 10, 2003 Posted September 10, 2003 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. Quote ..::[ kleptos ]::..
fotini Posted September 10, 2003 Author Posted September 10, 2003 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... Quote la grecque
kleptos Posted September 10, 2003 Posted September 10, 2003 Here is a connection string i use. I have never had any problems with it. "server=SERVER;database=DATABASE;uid=USERNAME;pwd=PASSWORD;" Quote ..::[ kleptos ]::..
fotini Posted September 10, 2003 Author Posted September 10, 2003 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 Quote la grecque
kleptos Posted September 10, 2003 Posted September 10, 2003 Do you get an SQL error or a .NET error? Whats the error you get. Quote ..::[ kleptos ]::..
fotini Posted September 10, 2003 Author Posted September 10, 2003 Server Error in abc Application Autorisation SELECT refusee sur l'objet "PERSONNEL", base de donnees "NetGestion", proprietaire dbo System.Data.SqlClient.SqlException Quote la grecque
Administrators PlausiblyDamp Posted September 10, 2003 Administrators Posted September 10, 2003 Have you given the account you created permissions to the table? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
kleptos Posted September 10, 2003 Posted September 10, 2003 Could you translate that error for me into english? Quote ..::[ kleptos ]::..
Administrators PlausiblyDamp Posted September 10, 2003 Administrators Posted September 10, 2003 I'm guessing here but is PERSONNEL' a view based on a table 'NetGestion'? (my grasp of languages other than english is very poor) If so who owns the PERSONNEL view and what permissions do they have to the table? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
fotini Posted September 10, 2003 Author Posted September 10, 2003 Authorization of SELECT is denied on the objet "Table1", database "Database1", owner dbo ??? Quote la grecque
kleptos Posted September 10, 2003 Posted September 10, 2003 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. Quote ..::[ kleptos ]::..
fotini Posted September 10, 2003 Author Posted September 10, 2003 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 Quote la grecque
fotini Posted September 11, 2003 Author Posted September 11, 2003 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... Quote la grecque
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.