SqlConnectionString\ODBC\VS2008

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gh

    SqlConnectionString\ODBC\VS2008

    I have the following code, in an ASP.NET app, to setup a connection in
    code.

    string connectionStrin g =
    "DSN=Interbase; UID=SYSDBA;DB=C :\\Data\\MEMDAT A.GDB;";
    SqlConnection con = new SqlConnection(c onnectionString );

    When I try to run the app I get the following error message

    System.Argument Exception: Keyword not supported: 'dsn'.

    How can I get an ODBC connection, to work with the code above?

    TIA
  • Lloyd Sheen

    #2
    Re: SqlConnectionSt ring\ODBC\VS200 8


    "gh" <gh@att.netwrot e in message
    news:uYNh3IjpIH A.1772@TK2MSFTN GP03.phx.gbl...
    >I have the following code, in an ASP.NET app, to setup a connection in
    code.
    >
    string connectionStrin g =
    "DSN=Interbase; UID=SYSDBA;DB=C :\\Data\\MEMDAT A.GDB;";
    SqlConnection con = new SqlConnection(c onnectionString );
    >
    When I try to run the app I get the following error message
    >
    System.Argument Exception: Keyword not supported: 'dsn'.
    >
    How can I get an ODBC connection, to work with the code above?
    >
    TIA
    Not sure what answer is but check out this page it has as many possible
    connection strings as I have seen:



    LS

    Comment

    • George Ter-Saakov

      #3
      Re: SqlConnectionSt ring\ODBC\VS200 8

      The SqlConnection is only for MS SQL server.
      If you using DSN then you need to use OdbcConnection class

      George


      "gh" <gh@att.netwrot e in message
      news:uYNh3IjpIH A.1772@TK2MSFTN GP03.phx.gbl...
      >I have the following code, in an ASP.NET app, to setup a connection in
      code.
      >
      string connectionStrin g =
      "DSN=Interbase; UID=SYSDBA;DB=C :\\Data\\MEMDAT A.GDB;";
      SqlConnection con = new SqlConnection(c onnectionString );
      >
      When I try to run the app I get the following error message
      >
      System.Argument Exception: Keyword not supported: 'dsn'.
      >
      How can I get an ODBC connection, to work with the code above?
      >
      TIA

      Comment

      • Mark Rae [MVP]

        #4
        Re: SqlConnectionSt ring\ODBC\VS200 8

        "gh" <gh@att.netwrot e in message
        news:uYNh3IjpIH A.1772@TK2MSFTN GP03.phx.gbl...
        ??
        >I have the following code, in an ASP.NET app, to setup a connection in
        code.
        >
        string connectionStrin g =
        "DSN=Interbase; UID=SYSDBA;DB=C :\\Data\\MEMDAT A.GDB;";
        SqlConnection con = new SqlConnection(c onnectionString );
        >
        When I try to run the app I get the following error message
        >
        System.Argument Exception: Keyword not supported: 'dsn'.
        >
        How can I get an ODBC connection, to work with the code above?
        You're using SqlConnection - that's only for SQL Server. If you absolutely
        must use ODBC, then you need OdbcConnection.

        But why are you trying to use ODBC when there is a perfectly good native
        ..NET data provider available...?



        --
        Mark Rae
        ASP.NET MVP


        Comment

        • gh

          #5
          Re: SqlConnectionSt ring\ODBC\VS200 8

          Mark Rae [MVP] wrote:
          "gh" <gh@att.netwrot e in message
          news:uYNh3IjpIH A.1772@TK2MSFTN GP03.phx.gbl...
          ??
          >I have the following code, in an ASP.NET app, to setup a connection in
          >code.
          >>
          >string connectionStrin g =
          > "DSN=Interbase; UID=SYSDBA;DB=C :\\Data\\MEMDAT A.GDB;";
          > SqlConnection con = new SqlConnection(c onnectionString );
          >>
          > When I try to run the app I get the following error message
          >>
          >System.Argumen tException: Keyword not supported: 'dsn'.
          >>
          >How can I get an ODBC connection, to work with the code above?
          >
          You're using SqlConnection - that's only for SQL Server. If you
          absolutely must use ODBC, then you need OdbcConnection.
          >
          But why are you trying to use ODBC when there is a perfectly good native
          .NET data provider available...?

          >
          >
          Mark:;
          I have the bdp driver installed. I added the bdp connection, adapter to
          my toolbox, but in my asp,net app they are grayed out. Any idea what
          would cause this? I am using VS 2008 and C#.

          TIA

          Comment

          • Mark Rae [MVP]

            #6
            Re: SqlConnectionSt ring\ODBC\VS200 8

            "gh" <gh@att.netwrot e in message
            news:eulpoJtrIH A.4560@TK2MSFTN GP03.phx.gbl...
            >>How can I get an ODBC connection, to work with the code above?
            >>
            >You're using SqlConnection - that's only for SQL Server. If you
            >absolutely must use ODBC, then you need OdbcConnection.
            >>
            >But why are you trying to use ODBC when there is a perfectly good native
            >.NET data provider available...?
            >http://cc.codegear.com/item/25298
            >>
            I have the bdp driver installed. I added the bdp connection, adapter to
            my toolbox, but in my asp,net app they are grayed out. Any idea what
            would cause this? I am using VS 2008 and C#.
            BDP? Do you mean the Borland Data Provider...?


            --
            Mark Rae
            ASP.NET MVP


            Comment

            • gh

              #7
              Re: SqlConnectionSt ring\ODBC\VS200 8

              Mark Rae [MVP] wrote:
              "gh" <gh@att.netwrot e in message
              news:eulpoJtrIH A.4560@TK2MSFTN GP03.phx.gbl...
              >
              >>>How can I get an ODBC connection, to work with the code above?
              >>>
              >>You're using SqlConnection - that's only for SQL Server. If you
              >>absolutely must use ODBC, then you need OdbcConnection.
              >>>
              >>But why are you trying to use ODBC when there is a perfectly good
              >>native .NET data provider available...?
              >>http://cc.codegear.com/item/25298
              >>>
              >I have the bdp driver installed. I added the bdp connection, adapter
              >to my toolbox, but in my asp,net app they are grayed out. Any idea
              >what would cause this? I am using VS 2008 and C#.
              >
              BDP? Do you mean the Borland Data Provider...?
              >
              >
              Mark:

              Yes.

              Thanks

              Comment

              • Mark Rae [MVP]

                #8
                Re: SqlConnectionSt ring\ODBC\VS200 8

                "gh" <gh@att.netwrot e in message
                news:u0bBmf2rIH A.548@TK2MSFTNG P06.phx.gbl...
                >>>>How can I get an ODBC connection, to work with the code above?
                >>>>
                >>>You're using SqlConnection - that's only for SQL Server. If you
                >>>absolutely must use ODBC, then you need OdbcConnection.
                >>>>
                >>>But why are you trying to use ODBC when there is a perfectly good
                >>>native .NET data provider available...?
                >>>http://cc.codegear.com/item/25298
                >>>>
                >>I have the bdp driver installed. I added the bdp connection, adapter to
                >>my toolbox, but in my asp,net app they are grayed out. Any idea what
                >>would cause this? I am using VS 2008 and C#.
                >>
                >BDP? Do you mean the Borland Data Provider...?
                >
                Yes.
                OK, as has been mentioned previously, SqlConnection is *ONLY* for Microsoft
                SQL Server - trying to use it with another RDBMS is not going to work.

                Since you're using the Borland Data Provider, I'm assuming that you're
                trying to connect to Borland InterBase. If so, then there is no need for
                OleDb or <shuddersODBC , as there is a perfectly good native .NET data
                provider available - you can find everything you need (including code
                samples) here: http://dn.codegear.com/article/31939


                --
                Mark Rae
                ASP.NET MVP


                Comment

                Working...