Sunday, February 26, 2012

Error with databound datagrid

Help,

I have a simple app that only has on datagrid that is bound by the typical sqlconnection,sqldataadapter and dataset. But I keep getting this error:

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

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 '(null)'. Reason: Not associated with a trusted SQL Server connection.
Source Error:

Line 55: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadLine 56: 'Put user code to initialize the page hereLine 57: SqlDataAdapter1.Fill(DataSet11)Line 58: DataGrid1.DataBind()Line 59:

WHY :)

xactly what the message says..can you post the connection string ?

|||
Indeed, fix your connectionstring. Get that working before messing withdatagrids. The error indicates that you're telling ADO.NET to use atrusted connection (i.e. windows authentication) but the ASPNET useraccount probably doesn't have access to your database. I typically useSQL authentication so I can limit the damage each application can do.One account per database.

No comments:

Post a Comment