Solved

sqlconnenction error - keyword not supported: Provider

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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