locked
I don't see Oracle in "Choose Data Source" window RRS feed

  • Question

  •  

    I work with Visual Studio 2008 Express Edition.

    My C# program works with Oracle.

    I did reference to System.Data.OracleClient and all work properly.

     

    Code Snippet

    string strConn= "Data Source= ...;User ID= ...;Unicode=True;Integrated

    Security=no;password=...";

    using (OracleConnection conn = new OracleConnection(strConn))

    {

    // all work properly

    }

     

     

    But I want to set connection string in Project properties / Settings

    When in Project properties / Settings I try to create Connection string in window "Choose Data Source" I don't see Item about ORACLE.

     

    And I cannot Add new data source in Visual Studion (Menu: Data / Add new data source) . There I must Choose Data Source too.

     

    Help me please.

    I'm sorry for my english.

     

     

    Tuesday, June 3, 2008 11:46 PM

Answers

  • This is by design. Visual Basic Express 2008 only supports local database types; Access, SQL Server Express and SQL Server CE when using the designer tools.

    You can still connect to Oracle and other database types from Visual Basic Express but you have to use ADO.NET code to establish the connection, create the DataSet/DataTable and retrieve a save setting.

    If you want to save a connection string setting you can do this manually by editing the App.config file for the application. If you need an example, save a connection string setting using the designer for an Access, SQL Server Express or SQL Server CE. Then open the App.config file and then look for the <connectionString> section.

    A sample Oracle connection string entry might look like the following (make sure to change "ProjectName" to the name of your project):

    Code Snippet

      <add name="ProjectName.My.MySettings.OracleConnection" connectionString="Data Source=OracleServerName;User ID=xxx;Unicode=True"   providerName="System.Data.OracleClient" />


    Once you add this to the App.config it should show up in the list on your Settings tab. You can then retrieve it using code:

    Code Snippet

    My.Settings.OracleConnection




    Wednesday, June 4, 2008 1:28 PM