Database Access in Web Applications 
Author Message
 Database Access in Web Applications

Hi,
I've been having problems with trying to get my web
application to allow me to retrive data from my
SqlServer.  I have one web form and on the form is a
DataGrid1 and a Load button.  I have a SqlDataAdapter and
it points to my SqlServer.  The DataGrid1 has its
DataSourse property set to DataSet11, the DataMember
property is set to the tblCar table.  The code behind my
load button is as follows:

        DataSet11.Clear()
        SqlDataAdapter1.Fill(DataSet11)
        DataGrid1.DataBind()

When I try to run the web form, the web form loads.  I
click on the Load button and there is an error when I get
to the DataGrid1.DataBind() line in the code.  The error
is as follows:

Server Error in '/MarksInternet' Application.

Login failed for 'JOHN\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 'JOHN\ASPNET'.

Source Error:

An unhandled exception was generated during the execution
of the current web request. Information regarding the
origin and location of the exception can be identified
using the exception stack trace below.

Stack Trace:

[SqlException: Login failed for user 'JOHN\ASPNET'.]
   System.Data.SqlClient.SqlConnection.Open()
   System.Data.Common.DbDataAdapter.QuietOpen
(IDbConnection connection, ConnectionState& originalState)
   System.Data.Common.DbDataAdapter.Fill(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)
   MarksInternet.WebForm1.Button1_Click(Object sender,
EventArgs e) in C:\Documents and Settings\Mark
Bogenschutz\VSWebCache\john\MarksInternet\WebForm1.aspx.vb
:155
   System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv
entHandler.RaisePostBackEvent(String eventArgument)
   System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument)
   System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData)
   System.Web.UI.Page.ProcessRequestMain()

'JOHN' is the name of the server that has the SqlServer
database and where my web application is located.
When I creat a Windows application and link my controls
to the SqlServer everything works just fine.  What am I
doing wrong with my web application?

Any response is appreciated.
Thank you for your time,
Mark



Mon, 07 Feb 2005 00:27:47 GMT  
 Database Access in Web Applications
It looks like you're using Windows authentication for logging in and the
ASPNET user which the ASP.NET service runs under is not a valid user in SQL
Server.  You can either create a login for this account or you can switch to
SQL Server authentication.


Quote:
> Hi,
> I've been having problems with trying to get my web
> application to allow me to retrive data from my
> SqlServer.  I have one web form and on the form is a
> DataGrid1 and a Load button.  I have a SqlDataAdapter and
> it points to my SqlServer.  The DataGrid1 has its
> DataSourse property set to DataSet11, the DataMember
> property is set to the tblCar table.  The code behind my
> load button is as follows:

>         DataSet11.Clear()
>         SqlDataAdapter1.Fill(DataSet11)
>         DataGrid1.DataBind()

> When I try to run the web form, the web form loads.  I
> click on the Load button and there is an error when I get
> to the DataGrid1.DataBind() line in the code.  The error
> is as follows:

> Server Error in '/MarksInternet' Application.

> Login failed for 'JOHN\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 'JOHN\ASPNET'.

> Source Error:

> An unhandled exception was generated during the execution
> of the current web request. Information regarding the
> origin and location of the exception can be identified
> using the exception stack trace below.

> Stack Trace:

> [SqlException: Login failed for user 'JOHN\ASPNET'.]
>    System.Data.SqlClient.SqlConnection.Open()
>    System.Data.Common.DbDataAdapter.QuietOpen
> (IDbConnection connection, ConnectionState& originalState)
>    System.Data.Common.DbDataAdapter.Fill(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)
>    MarksInternet.WebForm1.Button1_Click(Object sender,
> EventArgs e) in C:\Documents and Settings\Mark
> Bogenschutz\VSWebCache\john\MarksInternet\WebForm1.aspx.vb
> :155
>    System.Web.UI.WebControls.Button.OnClick(EventArgs e)

> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv
> entHandler.RaisePostBackEvent(String eventArgument)
>    System.Web.UI.Page.RaisePostBackEvent
> (IPostBackEventHandler sourceControl, String
> eventArgument)
>    System.Web.UI.Page.RaisePostBackEvent
> (NameValueCollection postData)
>    System.Web.UI.Page.ProcessRequestMain()

> 'JOHN' is the name of the server that has the SqlServer
> database and where my web application is located.
> When I creat a Windows application and link my controls
> to the SqlServer everything works just fine.  What am I
> doing wrong with my web application?

> Any response is appreciated.
> Thank you for your time,
> Mark



Mon, 07 Feb 2005 01:01:42 GMT  
 Database Access in Web Applications
Thanks for the help Karl,

I'm really new to SQL Server.  I know how to make tables
and enter in some data.  I've also added logins.  When I
try to create the SqlDataAdapter in vb.net and
select 'Use a specific user name and password' instead
of 'Use Windows NT Integrated security' in the Data Link
Properties dialog box, I enter in the appropriate
username and password that matches the login that I
entered into SQL Server and when I click on the 'Select
the database on the server' combo box it gives me a
message box that tells me 'Login failed for user 'Mark2'.
Reason: Not associated with a trusted SQL Server
connection.' I click ok and another message box pops up
and says 'Login failed. Catalog information cannot be
retrieved.'

Ultimately, I would like to have a Login: Username and
Password section on my web form to access the data on the
SQL Server.  Currently I'm having problems with just
creating the SqlDataAddapter from the wizard.  Do I have
to create the SqlDataAddapter, SqlConneciton, and DataSet
in code?  I've done that successfully with a windows
application, not with a specific login though.  

Thanks a lot for your input.

Quote:
>-----Original Message-----
>Message unavailable



Mon, 07 Feb 2005 05:40:05 GMT  
 Database Access in Web Applications
Thanks for the help Karl,

I'm really new to SQL Server.  I know how to make tables
and enter in some data.  I've also added logins.  When I
try to create the SqlDataAdapter in vb.net and
select 'Use a specific user name and password' instead
of 'Use Windows NT Integrated security' in the Data Link
Properties dialog box, I enter in the appropriate
username and password that matches the login that I
entered into SQL Server and when I click on the 'Select
the database on the server' combo box it gives me a
message box that tells me 'Login failed for user 'Mark2'.
Reason: Not associated with a trusted SQL Server
connection.' I click ok and another message box pops up
and says 'Login failed. Catalog information cannot be
retrieved.'

Ultimately, I would like to have a Login: Username and
Password section on my web form to access the data on the
SQL Server.  Currently I'm having problems with just
creating the SqlDataAddapter from the wizard.  Do I have
to create the SqlDataAddapter, SqlConneciton, and DataSet
in code?  I've done that successfully with a windows
application, not with a specific login though.  

Thanks a lot for your input.

Quote:
>-----Original Message-----
>It looks like you're using Windows authentication for
logging in and the
>ASPNET user which the ASP.NET service runs under is not
a valid user in SQL
>Server.  You can either create a login for this account

or you can switch to
Quote:
>SQL Server authentication.



>> Hi,
>> I've been having problems with trying to get my web
>> application to allow me to retrive data from my
>> SqlServer.  I have one web form and on the form is a
>> DataGrid1 and a Load button.  I have a SqlDataAdapter
and
>> it points to my SqlServer.  The DataGrid1 has its
>> DataSourse property set to DataSet11, the DataMember
>> property is set to the tblCar table.  The code behind
my
>> load button is as follows:

>>         DataSet11.Clear()
>>         SqlDataAdapter1.Fill(DataSet11)
>>         DataGrid1.DataBind()

>> When I try to run the web form, the web form loads.  I
>> click on the Load button and there is an error when I
get
>> to the DataGrid1.DataBind() line in the code.  The
error
>> is as follows:

>> Server Error in '/MarksInternet' Application.

>> Login failed for 'JOHN\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 'JOHN\ASPNET'.

>> Source Error:

>> An unhandled exception was generated during the
execution
>> of the current web request. Information regarding the
>> origin and location of the exception can be identified
>> using the exception stack trace below.

>> Stack Trace:

>> [SqlException: Login failed for user 'JOHN\ASPNET'.]
>>    System.Data.SqlClient.SqlConnection.Open()
>>    System.Data.Common.DbDataAdapter.QuietOpen
>> (IDbConnection connection, ConnectionState&
originalState)
>>    System.Data.Common.DbDataAdapter.Fill(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)
>>    MarksInternet.WebForm1.Button1_Click(Object sender,
>> EventArgs e) in C:\Documents and Settings\Mark

Bogenschutz\VSWebCache\john\MarksInternet\WebForm1.aspx.vb
Quote:
>> :155
>>    System.Web.UI.WebControls.Button.OnClick(EventArgs
e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEv

- Show quoted text -

Quote:
>> entHandler.RaisePostBackEvent(String eventArgument)
>>    System.Web.UI.Page.RaisePostBackEvent
>> (IPostBackEventHandler sourceControl, String
>> eventArgument)
>>    System.Web.UI.Page.RaisePostBackEvent
>> (NameValueCollection postData)
>>    System.Web.UI.Page.ProcessRequestMain()

>> 'JOHN' is the name of the server that has the SqlServer
>> database and where my web application is located.
>> When I creat a Windows application and link my controls
>> to the SqlServer everything works just fine.  What am I
>> doing wrong with my web application?

>> Any response is appreciated.
>> Thank you for your time,
>> Mark

>.



Mon, 07 Feb 2005 22:01:14 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Database access from Web Application

2. Transform a Microsoft Access Application to a Web Application

3. code to access an MS ACCESS database held on a web site

4. code to access an ACCESS database help on a web site

5. Trouble accessing an Access database from web

6. Access Database concurrent users in VB 4.0 application and Database Security

7. Access Database concurrent users in VB 4.0 application and Database Security

8. Visual basic application to access microsoft access database

9. converting a VB database application to web based?

10. web database application question.

11. web database application question.

12. Database to Web Applications

 

 
Powered by phpBB® Forum Software