Solved

sqlconnenction error - keyword not supported: Provider

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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