locked
Error in Oracle data provider string RRS feed

  • Question

  • User1433899244 posted

    hi,

    I am trying to create a windows application in .net toaccess Oracle database. I have defined my connectionstring in my app.config file.

    Now I get the error, 
    An OLE DB Provider was not specified in the ConnectionString.  An example would be, 'Provider=SQLOLEDB;'.

    I tried all the provider types in the apge, http://www.connectionstrings.com/oracle.
    I have always worked with SQL but now in Oracle, I am not sure why the same thing would not work.
    My .net code is,
    <connectionStrings>
            <add name="DBConnectionString" providerName="OraOLEDB.Oracle"
                  connectionString="data source=testdb;Integrated Security=true;User ID=test;Password=test;" />
        </connectionStrings>
    
    Code:
    
    Dim conSettings As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("DBConnectionString")
            Dim connectionString As String = conSettings.ConnectionString
    
    
            Dim myConnection As OleDbConnection = New OleDbConnection(connectionString)
            Dim strsql_fn As String = "SELECT first_name FROM dbnames ORDER BY dbms_random.value " & _
                                    "WHERE rownum < 250"
            comSelect1 = New OleDbCommand(strsql_fn, myConnection)
                
            myConnection.Open()
            myreader1 = comSelect1.ExecuteReader

    can somebody please guide me..thank you
    Tuesday, August 16, 2011 4:24 PM

All replies

  • User269602965 posted

    fix some code errors first, like extra )

    "SELECT first_name FROM dbnames ORDER BY dbms_random.value )"

    should be

    "SELECT first_name FROM dbnames ORDER BY dbms_random.value "

    +++++++++++++++++++

    Use exception handling to get more detailed error reporting.

    Tuesday, August 16, 2011 9:46 PM