|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Help - Simple DataGrid Problem in Vis. Studio 2003As a relative newbie to SQL Server/ASP.NET I'm hoping someone here can help with my problem. I'm developing a timesheet application in ASP.NET C# using Visual Studio 2003 with a database built in MSDE. One of my forms needs to return a simple list of resources from my database. I have followed the guide on the MSDN libraries, but for some reason I continuously get the same error message. What I've done so far is Create the database, tables, and populate with some sample data using using Server Explorer in Visual Studio. I have connected to the database (using integrated security) and I am trying to get the contents of the Resource table to appear on my form. I have then created a DataAdapter (tested the connection, set the SQL as a simple SELECT * from Resource, etc), which also generates an sqlConnection for me. To test this I have previewed the generated data, and it returns what I want, so I have chosen to generate a DataSet of this. I am then trying to get this data into a simple DataGrid. On the properties of the DataGrid I have changed the DataSource to point at my Dataset. As I understand it, I then have to add the following to my Page Load section of my code. sqlConnection1.Open(); this.sqlDataAdapter1.Fill(this.dsResource); sqlConnection1.Close(); The form builds fine, but when I browse to the particular form I get the following error for the sqlConnection1.Open(); line Exception Details: System.Data.SqlClient.SqlException: Cannot open database requested in login 'SCMS'. Login fails. Login failed for user 'AL-NOTEPAD\ASPNET'. To me this is an error with my connection string. My database instance is actually 'AL-NOTEPAD\VSDOTNET'. However the properties for sqlConnection1 are pointing to the correct datasource. I do not know why the application is looking for user 'AL-NOTEPAD\ASPNET'. It does not exist, to my knowledge. Any help with this would be greatly appreciated, as I get the same error with my code for forms-based login... Thanks in advance.. thebison (alex.sincla***@btinternet.com) writes:
> The form builds fine, but when I browse to the particular form I get I guess that's why the login fails. :-)> the following error for the sqlConnection1.Open(); line > > Exception Details: System.Data.SqlClient.SqlException: Cannot open > database requested in login 'SCMS'. Login fails. Login failed for > user 'AL-NOTEPAD\ASPNET'. > > To me this is an error with my connection string. My database > instance is actually 'AL-NOTEPAD\VSDOTNET'. However the properties > for sqlConnection1 are pointing to the correct datasource. I do not > know why the application is looking for user 'AL-NOTEPAD\ASPNET'. It > does not exist, to my knowledge. I believe this has to do with that IIS runs the in a context of a pre- defined user, and IIS the tries to log in with integrated security, but the ASPNET user have not been granted access to the database. But you are probably better off asking in a newsgroup about ASP .Net. At least I know very little about ASP .Net. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Qualifing table names with dbo
Stored procedures, nullable parameters, COALESCE Naming Conventions: Prefixing Columns w/ Table Names Lost Trigger 1 database, 2 threads Isolation levels and SELECT's (even when using SERIALIZABLE!) Group By (part of a field) linked server problem on SQL Server 2000 sp3 query performance Look for differences |
|||||||||||||||||||||||