Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Server 2005 Support

Author  Topic 

Fu
Starting Member

23 Posts

Posted - 2005-10-18 : 09:04:38
I am using MS SQL Server 2005 n Visual Studio dot net 2005, When starting the managment studio i connect using windows authentication but the problem arises when i need to open an oledbconnection via ado.net with the syntax:
oconn=new oledbconnection(provider=;data source=,user id=,password equal) since windows doesnt include any password i cant use the user id and password fields which causes errors althugh i created a password for my windows account the same stuff again
is there any problem to change the connection method from windows authentication to sql server authentication and how can i create a login id and password.
thank you

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-18 : 13:00:27
Using SQL authentication is not recommended and yes you are correct that you don't supply a password for the windows authentication. You also don't supply a userid for it either. Using Windows authentication means you are going to use the account that is logged into the computer already.

What error are you getting?

Tara
Go to Top of Page

Fu
Starting Member

23 Posts

Posted - 2005-10-18 : 15:42:26

Server Error in '/' Application.
Invalid authorization specification
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: Invalid authorization specification

Source Error:

Line 6: Dim oconn As New OleDbConnection
Line 7: oconn = New OleDbConnection("Provider =sqloledb;Data Source =DR;Initial Catalog =BM")
Line 8: oconn.Open()
Line 9: oconn.Close()
Line 10:


Source File: c:\inetpub\wwwroot\adoconn.aspx Line: 8

Stack Trace:

[OleDbException (0x80004005): Invalid authorization specification]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +975201
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +53
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +27
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +47
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.OleDb.OleDbConnection.Open() +37
ASP.adoconn_aspx.page_load(Object sender, EventArgs e) in c:\inetpub\wwwroot\adoconn.aspx:8
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +36
System.Web.UI.Control.OnLoad(EventArgs e) +102
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1064


Version Information: Microsoft .NET Framework Version:2.0.50215.44; ASP.NET Version:2.0.50215.44
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-18 : 16:17:50
I don't believe your connection string is in a valid format. Check out this site for examples:
www.connectionstrings.com

Also, it is better to use the SqlConnection rather than OleDbConnection if your database server is SQL Server (any version).

Tara
Go to Top of Page
   

- Advertisement -