Monday, March 19, 2012

MSDE newbie

Hi guys,
I am a new user in msde and I'm wondering what do I need to get it to work. Currently I've already got the engine installed on my pc. So where do I go from here? Thanks in advance.

Ok, I managed to find out that MSDE can be utilized from the web matrix. I went through the walkthrough provided on the web matrix homepage and was able to create a database of my own. However, now I've got another problem. When I run the aspx page in the web matrix server, everything works. However, when I run it using the IIS, the following error is thrown:

Server Error in '/chapter9' Application.

Login failed for user 'silvertype\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 'silvertype\ASPNET'.
Source Error:
Line 7: Line 8: conPubs = New SqlConnection( "server='(local)'; trusted_connection=true; database='pubs'" )Line 9: conPubs.Open()Line 10: cmdSelectAuthors = New SqlCommand( "Select au_lname From Authors", conPubs )Line 11: dtrAuthors = cmdSelectAuthors.ExecuteReader()

Source File:C:\Inetpub\wwwroot\aspnet_unleashed\chapter9\sqldatareader.aspx Line:9
Stack Trace:
[SqlException: Login failed for user 'ROGER\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 ASP.SqlDataReader_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in C:\Inetpub\wwwroot\aspnet_unleashed\chapter9\sqldatareader.aspx:9 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27 System.Web.UI.Control.Render(HtmlTextWriter writer) +7 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243 System.Web.UI.Page.ProcessRequestMain() +1926



Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

My Code is as below:
<%@. Page Language="VB" Debug="True" %>
<%@. import Namespace="System.Data.SqlClient" %>
<%
Dim conPubs As SqlConnection
Dim cmdSelectAuthors As SqlCommand
Dim dtrAuthors As SqlDataReader

conPubs = New SqlConnection( "server='(local)'; trusted_connection=true; database='pubs'" )
conPubs.Open()
cmdSelectAuthors = New SqlCommand( "Select au_lname From Authors", conPubs )
dtrAuthors = cmdSelectAuthors.ExecuteReader()
While dtrAuthors.Read()
Response.Write( "<li>" )
Response.Write( dtrAuthors( "au_lname" ) )
End While
dtrAuthors.Close()
conPubs.Close()
%>
Any idea what's wrong?

|||Yes. You either need to grant the windows ASPNET account privilleges for your SQL Server instance, or you need to get rid of the trusted_connection parameter and specify an SQL login (i.e. uid=sa; pwd=password;) in your connection string. I would go with the latter when using MSDE as it is alot easier.|||

IC...Finally, I managed to get it to work. Thanks a lot. Guys like you really make this community a wonderful place :)

|||Not a problem. Glad I could help.

No comments:

Post a Comment