Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing SQL Data in ASP.NET Application

Status
Not open for further replies.

BiniamTek

IS-IT--Management
May 16, 2003
22
0
0
US
Hello

I have created a Web App that is to use a SQL database. In IDE, I can view the table from "Retrieve Data from Table", I can connect to my server, I can connect to the database, and the test connection returns success. However, when I run the app, nothing is displayed on the web page, I don't even see a blank DataGrid. I have IIS and SQL Server running.

I have also tried to add a Web Reference but the Web Reference Browser is disabled. My application is written in C# but I believe VB users can also answer this question.

Please help.

Thanks.
 
On page load, did you bind your datagrid?

MyGrid.DataBind();
 
On Page_Load I have

myComponent.FillDataSet(myDataSet);
myDataGrid.DataBind();
 
Did you make sure that the datagrid has it's datasource property set to your datagrid?

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Try putting a text box on the page....see if that comes up...see any web forms controls are rendered.
 
I put some LinkButtons and I can see them
 
I do not know how but after installing a few service packs, I am now getting the following error.

Server Error in '/MyWebForm' Application.
--------------------------------------------------------------------------------

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

Source Error:


Line 25: public void FillDataSet(myDataSet dSet)
Line 26: {
Line 27: sqlDataAdapter1.Fill(dSet);
Line 28: }
Line 29: // My code ends here


Source File: c:\inetpub\ Line: 27

Stack Trace:


[SqlException: Login failed for user 'BROMIOS\ASPNET'.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
MyWebForm.Component1.FillDataSet(myDataSet dSet) in c:\inetpub\ MyWebForm.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\ System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
 
The SqlConnection is trying to Login to SQL Server under the Login 'BROMIOS\ASPNET'. Does this Login have permission etc. to the tables, queries, sProc's necasary...


Rhys
Thought out... Maybe,
Opinionated... Probably
But it is only an opinion!
 
Thanks. I finally got it. I set the permission in SQL Server and I got what I want. Thanks again for all of you.
 
BiniamTek, I am having the same problem - I am not sure how the /ASPNET portion comes into play, it seems to come in only if the DataGrid is used & bound. I am able to use the same SQL Server db otherwise when DataGrids are not used (probably a result of using the SQLAdapter Wizard.

How did you adjust your SQL Server I/permissions to fix this problem? I am using the SQL Server 2000 that comes with VS.NET.

Thanks for any help in this.
 
DLLHelp

In SQL Server enterprise Manager, add ASPNET user under users in your database and set the permissions.
 
I am having a similar problem but i am having it when i try to connect to connect to the SQL Db, i have set the web.config for integrated security but it is telling me it cannot log on user "\" and i am sure that i am not logged on as "\".

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top