السلام عليكم ورحمة الله وبركاته
أردت أن أعمل connection بين ASP.NET تحت Microsoft Visual Studio.NET 2003 و SQL Server 2000 فكتبت هذا الكود(انسخوه في Notepad حتى ترونه بوضوح):
*************************************************************************************
Public Class WebForm1
Inherits System.Web.UI.Page
Dim Connection As New SqlClient.SqlConnection
Web form Designer Generate code
________________________________________________
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Connection.ConnectionString = "data source=SALMA-H1STH3TGR;" & _
"database=CASFSU;integrated security=true"
End Sub
________________________________________________
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sqlda As New SqlClient.SqlDataAdapter("select *" & _
"from Univercity", Connection)
Dim ds As New DataSet
sqlda.Fill(ds)
Me.DataGrid1.DataSource = ds
Me.DataBind()
End Sub
End Class
*************************************************************************************
ولكن إذا عملت Run وضغطت الزر يطلع لي هذا Error :
*************************************************************************************
Server Error in '/asp1' Application.
--------------------------------------------------------------------------------
Login failed for user 'SALMA-H1STH3TGR\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.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'SALMA-H1STH3TGR\ASPNET'.
Source Error:
Line 75: "from Univercity", Connection)
Line 76: Dim ds As New DataSet
Line 77: sqlda.Fill(ds)
Line 78: Me.DataGrid1.DataSource = ds
Line 79: Me.DataBind()
Source File: c:\inetpub\wwwroot\asp1\WebForm1.aspx.vb Line: 77
Stack Trace:
[sqlException: Login failed for user 'SALMA-H1STH3TGR\ASPNET'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
asp1.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\asp1\WebForm1.aspx.vb:77
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
*************************************************************************************
فأرجوكم أريد الحل لهذا Error بأسرع وقت ممكن وما هو سببه..