I just installed SQL Server 2000 EVAL ver, in my Win XP Pro machine and the installtion was succesful though I get the following error once I run the code.
What does this mean ? What should I do here ?
----------------------
[SqlException: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +311
System.Data.SqlClient.SqlConnection.Open() +383
ASP.DropDownList_aspx.Page_Load() +61
System.Web.Util.ArglessEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +10
System.Web.UI.Control.OnLoad(EventArgs e) +55
System.Web.UI.Control.LoadRecursive() +27
System.Web.UI.Page.ProcessRequestMain() +731you need to add a user to the users list. if you xpand the your database in sql serve xplorer under users you need to add the machinename\ASPNET user account to grant access to the tables.
hth|||Hi Ndinakar,
Thanks for your help though I have the same, it gives the errors again.
I do run SQL 2000 Evaluation Version in Win XP Professional which is in home use.
(NOT connected into a Server or a Domain)
TIA
dan|||you prbly have an incorrect connection string. check this site for some sample connection strings :http://www.connectionstrings.com
hth|||naw, you didn't put a strong sa password, and it's looking for nt security.|||Hi
Thanks for both of you for the great help.
This is my code and the error message is pasted down. Further my ID and password is mentioned as in the SQL Server.
Further I am very new to ASP.net and just try to study the examples of ASP.net UNLEASHED published by SAMS.
<%@. Page Language="VB" %>
<%@. import Namespace="System.Data" %>
<%@. import Namespace="System.Data.SqlClient" %>
<script runat="server"
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=tkpkkalu"
Dim conPubs As SqlConnection
Sub Page_Load
Dim dtrAuthors As SqlDataReader
dtrAuthors = GetAuthors()
While dtrAuthors.Read
lblAuthors.Text &= "<li>"
lblAuthors.Text &= dtrAuthors( "au_lname" )
End While
dtrAuthors.Close()
lblAuthors.Text &= "
Connection is:" & conPubs.State.ToString()
End Sub
Function GetAuthors() As SqlDataReader
Dim cmdAuthors As SqlCommand
conPubs = New SqlConnection( "Server=localhost;UID=sa;PWD=secret;database=pubs" )
cmdAuthors = New SqlCommand( "select * from Authors", conPubs )
conPubs.Open()
Return cmdAuthors.ExecuteReader( CommandBehavior.CloseConnection )
End Function
</script>
<html>
<head>
<title>SqlCloseConnection.aspx</title>
</head>
<body>
<asp:Label id="lblAuthors" runat="Server"></asp:Label>
</body>
</html
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30035: Syntax error.
Source Error:
Line 5:
Line 6:
Line 7: "Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=tkpkkalu"
Line 8:
Line 9:
Source File: C:\Inetpub\wwwroot\SqlCloseConnection.aspx Line: 7|||are we missing something between these lines ?
<script runat="server"
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=tkpkkalu"Dim conPubs As SqlConnection
change the above lines to
<script runat="server">
Dim conPubs As SqlConnection
conPubs.connectionstring="Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=tkpkkalu"
also you are missing parameters for the page_load sub.
sub page_load (Sender as Object, e as EventArgs)
hth
No comments:
Post a Comment