farid Posted May 26, 2003 Posted May 26, 2003 every time I try to connect to Sql server I got this error Login failed for user 'music'. Reason: Not associated with a trusted SQL Server connection. Invalid connection string attribute or any user fail even "sa" Page Code <%@ Page LANGUAGE="VB"%> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDB" %> <SCRIPT LANGUAGE="VB" RUNAT="server"> Sub Page_Load(Sender As Object, E As EventArgs) Dim oConn As OleDBConnection Dim sConnString As String sConnString = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=Music;UserID=music;Password=music" oConn = New OleDBConnection(sConnString) oConn.Open() oConn.Close() End Sub </SCRIPT> <HTML> <BODY> Opening a Connection! </BODY> </HTML> Can any one help Quote
bungpeng Posted May 26, 2003 Posted May 26, 2003 I think it is your SQL permission problem, not the programming logic problem. Did you try to connect using other language like VB? just to confirm what is the problem come from. May I know how do you set your SQL permission/security when you create a user for it? like "music" user in this case? for "Music" database. Quote
wyrd Posted May 26, 2003 Posted May 26, 2003 Ah, I've been through this. The above poster is pretty much right. The user music either 1) doesn't exist, 2) doesn't have access to the specified database, or 3) the user isn't set as the database owner. Is this user perhaps a windows user? A windows user is totally different then a user set up inside the database itself. If this is indeed a windows user then you need to connect using Windows Integrated Security. Quote Gamer extraordinaire. Programmer wannabe.
farid Posted May 26, 2003 Author Posted May 26, 2003 user music exits and he is a music "database" db_owner Quote
farid Posted May 26, 2003 Author Posted May 26, 2003 And now I got this error Login failed for user 'ASPNET'. Invalid connection string attribute 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.OleDb.OleDbException: Login failed for user 'ASPNET'. Invalid connection string attribute why ??????????????????????? Quote
bungpeng Posted May 26, 2003 Posted May 26, 2003 Did you try to connect using VB? just a simple db connection, we need to confirm whether it is database problem or .net problem. Because as you mentioned above, everything should be fine... Quote
*Gurus* Derek Stone Posted May 26, 2003 *Gurus* Posted May 26, 2003 Are you running this code against an instance of MSDE? If that is the case you need to configure MSDE for SQL authentication, not Windows NT authentication. http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q285097 Quote Posting Guidelines
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.