Solved

sqlconnenction error - keyword not supported: Provider

Posted on 2004-09-27
4
15,994 Views
Last Modified: 2011-08-18
Hi Experts,
I'm trying to open a connection to sql server using sqlclient class. I'm getting the following error:

Keyword not supported: 'provider'.
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.ArgumentException: Keyword not supported: 'provider'.

Source Error:


Line 25:     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 26:         loConn = New SqlConnection
Line 27:         loConn.ConnectionString = "Provider=sqloledb;Data Source=servername;Initial Catalog=database name;User Id=sa;Password=sa"
Line 28:


Source File: C:\Inetpub\wwwroot\Test\TestFr.aspx.vb    Line: 27

Stack Trace:


[ArgumentException: Keyword not supported: 'provider'.]
   System.Data.Common.DBConnectionString.ParseInternal(Char[] connectionString, UdlSupport checkForUdl, NameValuePair& keychain) +1133
   System.Data.Common.DBConnectionString..ctor(String connectionString, UdlSupport checkForUdl) +114
   System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +13
   System.Data.SqlClient.SqlConnectionString.ParseString(String connectionString) +96
   System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +11
   WaliTest.WebForm4.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\LNI-OLRS\OLRSTocFr.aspx.vb:27
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +772

 
The error is in the line where i try to assing the connectionstring. The same code works on one machine and not on other. Could someone pls help?

Thanks in advance..
0
Comment
Question by:yuvarajr
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
praneetha earned 250 total points
ID: 12162075
string ConnStr="data source =servername;initial catalog=databasename;uid=userid;pwd=passwd";

try that withot provider
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12162129
Your connection string should look like one of the following depending upon your authentication method:

#    SqlConnection (.NET)


    *  Standard Security:
      "Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
         - or -
      "Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
         (booth connection strings produces the same result)


    *  Trusted Connection:
      "Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
         - or -
      "Server=Aron1;Database=pubs;Trusted_Connection=True;"
         (booth connection strings produces the same result)

          (use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)

    *  Connect via an IP address:
      "Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"

          (DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))

    *  Declare the SqlConnection:

          C#:
          using System.Data.SqlClient;
          SqlConnection oSQLConn = new SqlConnection();
          oSQLConn.ConnectionString="my connectionstring";
          oSQLConn.Open();



          VB.NET:
          Imports System.Data.SqlClient
          Dim oSQLConn As SqlConnection = New SqlConnection()
          oSQLConn.ConnectionString="my connectionstring"
          oSQLConn.Open()

Regards,

Aeros
0
 

Author Comment

by:yuvarajr
ID: 12162261
thanks praneetha..that did the trick..
but why woud it work on one machine and not on the other??..the only difference betn these machines is that the working one has VS.NEt 2002 and the other has vs.net2003..
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12162299
may be it just neglects provider in .net 2002...

try giving some junk value like provider="junkxxx" and see if it throws any error in .net 2002
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now