NEW to dotconnect for oracle

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 3
Joined: Tue 08 Dec 2009 12:59

NEW to dotconnect for oracle

Post by aidanc » Tue 08 Dec 2009 13:09


can I write this kind of code using dotconnect

Dim strconn As String = "Data Source=" + gdatabaseip + ";Initial Catalog=" + gdatabasename + ";integrated security=false;user id=" + guserid + ";password=" + gpassword + ";connect timeout=20 "

Dim cn As New SqlConnection(strconn)

strsql = "select * from emp"
Using cmd As New SqlCommand(strsql, cn)

what is equalvalent of the above useing dotconnect or does it all have to be done through datatable/dataadapeter classes that they provide.



Devart Team
Posts: 8085
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 09 Dec 2009 08:07

Once dotConnect for Oracle is installed, you can connect from your application to your database with a connection string using either the Common Programming Model (via DbProviderFactory, refer to MSDN) or the dotConnect for Oracle data provider-specific objects. Here is a sample of using the dotConnect for Oracle objects:

Code: Select all

  Dim myConnString As String = "User Id=scott;Password=tiger;Server=OraServer;"
  Dim mySelectQuery As String = "select * from emp"
  Dim myConnection As New OracleConnection(myConnString)
  Dim myCommand As New OracleCommand(mySelectQuery, myConnection)
    Dim myReader As OracleDataReader = myCommand.ExecuteReader()
    ' Always call Read before accessing data.
    While myReader.Read()
      Console.WriteLine(myReader.GetInt32(0).ToString() + ", " _
          + myReader.GetString(myReader.GetOrdinal("ENAME")))
    End While
    ' always call Close when done reading.
    ' Close the connection when done with it.
  End Try
For more information, please refer to our tutorials. If you have any further questions, feel free to contact us.

Post Reply