Solved

sqlconnenction error - keyword not supported: Provider

Posted on 2004-09-27
4
16,076 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

930 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

20 Experts available now in Live!

Get 1:1 Help Now