Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 25th, 2006, 02:22 PM
Registered User
 
Join Date: Sep 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Muzzy
Default Problems with datagrid (plizzz help)

I have on my webform one datagrid element and i'd like to fill it from database... i'm writing needed code, but after compiling the page during runtime i get such error:

Server Error in '/web/data' Application.
--------------------------------------------------------------------------------

Login failed for user 'NETSDK\ASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Does anybody has any idea to help me in solving this problem?

 
Old September 25th, 2006, 02:54 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

It depends on where the error occured in your code; it could be a permission's issue with the database or with your application directory. Post the stack trace, error message, etc.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
 
Old September 26th, 2006, 02:16 PM
Registered User
 
Join Date: Sep 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Muzzy
Default

Source Error:

Line 24: SqlConnection sqlConnection1 = new SqlConnection("server=(local);database=NorthwindCS ;Integrated Security=SSPI");
Line 25: SqlDataAdapter myCommand = new SqlDataAdapter("select * from Customers",sqlConnection1);
Line 26: sqlConnection1.Open();
Line 27: DataSet ds = new DataSet();
Line 28: myCommand.Fill(ds,"Customers");

Error is on the Line 26... And here is stack trace:

Stack Trace:

[SqlException: Login failed for user 'NETSDK\ASPNET'.]
   System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) +484
   System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
   System.Data.SqlClient.SqlConnection.Open() +384
   data.WebForm1.Page_Load(Object sender, EventArgs e) in f:\vs_examples\web\data\webform1.aspx.cs:26
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731

I hope somebody will help me...

 
Old September 26th, 2006, 02:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..

looks like integrated security is no good to access that database...

are you sure you have permission??

HTH

Gonzalo
 
Old September 26th, 2006, 02:32 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do this:
In sql create a new user and give them right to the Northwind database
Change your connection string to this:

"user ID=[user];password=[password];data source=(local);persist security info=True;initial catalog=NorthwindCS"

where [user] and [password] are the ones you just created.

BTW, the error you got is related to the user not having permission to access the database.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
 
Old September 26th, 2006, 03:11 PM
Registered User
 
Join Date: Sep 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Muzzy
Default

I have created a user and gave a right to NorthwindCS, but I still have a problem...

Server Error in '/web/data' Application.
--------------------------------------------------------------------------------

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


Source Error:


Line 24: SqlConnection sqlConnection1 = new SqlConnection("user ID=Muzzy;password=nizo1988;data source=(local);persist security info=True;initial catalog=NorthwindCS");
Line 25: SqlDataAdapter myCommand = new SqlDataAdapter("select * from Customers",sqlConnection1);
Line 26: sqlConnection1.Open();
Line 27: DataSet ds = new DataSet();
Line 28: myCommand.Fill(ds,"Customers");



 
Old September 26th, 2006, 03:40 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do this in enterprise manager:

Expand the tree-control until you can your server
Right click on the server name and "SQL Server Properties (Configure)" window will open
Select the Security tab
For "Authentication", select "SQL Server and Windows"
Click "OK" to close the window and then "Yes" to restart SQL Server

this should clear up your error.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
 
Old September 26th, 2006, 03:47 PM
Registered User
 
Join Date: Sep 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Muzzy
Default

THANK YOU A LOT! It helped me!

 
Old September 26th, 2006, 04:29 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Your very welcome, glad it worked for you.

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid performance problems GS C# 2005 1 April 18th, 2007 03:05 AM
problems with multiple parameters and datagrid gobotsoup General .NET 0 February 16th, 2007 05:08 PM
Datagrid Problems bourne74 ASP.NET 1.0 and 1.1 Basics 3 January 10th, 2006 05:41 PM
Problems using collection with datagrid i9796674 C# 1 August 8th, 2005 08:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.