The first time I used ASP.NET to complete symbolic homework, I used ASP.NET for the first time, sweat. So I immediately encountered the problem. I now write this problem. For those who have developed ASP.NET, this problem should not be a problem. I am just targeting those who have just touched ASP.NET. When I tried DataGrid last night, the following errors appeared:
The server error in the "/DataGridtest" application.
------------------------------------------------ ----------------------------------------------------------------------------
The user 'HP-2VI88M4GB/ASPNET' failed.
Note: During the current web request, unreasonable abnormalities occur. Please check the stack tracking information to understand the detailed information about the error and the source of the error in the code.
Details: System.data.sqlclient.sqlexception: User 'HP-2V47VI88M4GB/ASPNET' Login failed.
Source error:
Walk 31: If (! This.ispostback))
Line 32: {
Ring 33: sqldataadapter1.fill (dataset11,0,10, "Products"); "Products");
Line 34: This.databind ();
Line 35:}
Source file: C: /ineTPub/wwwroot/dataGridtest/webform1.aspx.cs Line: 33
Stack tracking:
[Sqlexception: User 'HP-2V47VI88M4GB/ASPNET' Login failed. ]
System.data.sqlclient.connectionPool.GetConnection (Boolean & Isintraction) +474
System.data.sqlClient.sqlconnectionPoolManager.GetpooledConnection (SQLConnectionStringOptions, Boolean & IsinTransaction) +372
system.data.sqlclient.sqlconnection.open ()+384
system.data.Common.dbdataadapter.quietopen (IDBConnectionConnection, ConnectionState & OriginalState) +44 +44
System.data.Comon.dbdataadapter.fillfromCommand (ObjectData, Int32StartReco D, Int32MaxRecords, Stringsrctable, IDBCommandCommand, CommandBehavior)))) +304
System.data.Common.dbdataDapter.fill (DataSetDataSet, Int32StartRecord, Int32maxRecords, StringsRctable, IDBCommandCommand, CommandBehavior) +77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 77
System.data.Common.dbdataDapter.fill (DataSetDataSet, Int32StartRecord, Int32MAXRECORDS, StringsRctable) +40) +40
datagridtest.webform1.page_load (ObjectSender, EventArgse) Inc: /Intpub/wwwroot/datagridtest/webform1.aspx.cs: 33: 33
System.web.ui.Control.onload (eventargse) +67 +67
System.web.ui.control.loadResive ()+35
System.web.ui.Page.ProcessRequestmain ()+750
=========================================== ==========================
According to the Exception of my appearance, my solution is as follows:
1. Create a "computer name/ASPNET" user in SQLSERVER. For example, I created HP-2V47VI88M4GB/ASPNET
2. Open the "Security" folder in SQLENTERPRISEMANAGER, right -click "Login", and select "New Login ...". The "Conventional" tab, "Name" Fill in HP-2V47VI88M4GB/ASPNET, other default; the "Database Access" tab, specified the visited database, I designated the northwind database, and then give him the permissions: DBO, PUBLIC is enough Essence
If you have a better way, please do not advice