Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sqlconnenction error - keyword not supported: Provider

Posted on 2004-09-27
4
Medium Priority
?
16,636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
praneetha earned 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 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