Re: Development envionment vs runtime??

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Greg Burns (greg_burns_at_DONT_SPAM_ME_hotmail.com)
Date: 07/18/04


Date: Sun, 18 Jul 2004 13:10:00 -0400

Stu,

I don't know Oracle, but where do you open your connection? Where are you
closing your datareader? Probably not relevant since you say it runs in IDE
anyways.

Greg

        Dim ConOra As New OracleConnection("User
Id=USER;Password=PASSWORD;Data Source=orcl9i;")
        Dim Sql As String = "select * from CCO_MOTD order by ID "
        Dim cmd As New OracleCommand(Sql, ConOra)

        Dim reader As OracleDataReader
        Try
            ConOra.Open()
            ' Execute command, create OracleDataReader object
            reader = cmd.ExecuteReader()
            While (reader.Read())
                Message(reader.GetDecimal(12)) = reader.GetString(0)
                MaxMessage = reader.GetDecimal(12)
                Console.WriteLine("MSG: " + Message(MaxMessage))
            End While

        Catch ex As Exception
            MsgBox(ex.ToString)

        Finally
            If Not reader Is Nothing AndAlso Not reader.IsClosed Then
reader.Close()

            If Not ConOra Is Nothing AndAlso Not ConOra.State =
ConnectionState.Closed Then ConOra.Close()

            cmd.Dispose()
        End Try

"Stu" <Stu@thynk.us> wrote in message
news:OhbNKB7aEHA.3512@TK2MSFTNGP12.phx.gbl...
> with the following code snippet
>
> Dim ConOra As OracleConnection = New OracleConnection()
> ConOra.ConnectionString = "User Id=USER;Password=PASSWORD;Data
> Source=orcl9i;"
> Dim Sql As String = "select * from CCO_MOTD order by ID "
> Dim cmd As OracleCommand = New OracleCommand(Sql)
> cmd.Connection = ConOra
> cmd.CommandType = CommandType.Text
> ' Execute command, create OracleDataReader object
> Dim reader As OracleDataReader = cmd.ExecuteReader()
> While (reader.Read())
> Message(reader.GetDecimal(12)) = reader.GetString(0)
> MaxMessage = reader.GetDecimal(12)
> Console.WriteLine("MSG: " + Message(MaxMessage))
> End While
> cmd.Dispose()
>
> Everyone runs happy and fine in the development envionment. When I create
> the install files, or run the .exe, it throws a 'Object reference not set
> to
> an instance of an object' error at the While(reader.Read()). This happens
> on other systems as well as my own.
>
> An interesting note, when running the exe file on a coworkers machine,
> who's
> setup is the same as mine (same version of .NET runtime, same version of
> VS.NET and same version of Oracle) - things run just fine when running
> the
> .exe file.
>
> Where do I go from here, is this a known issue, help ?
>
> Thanks much in advance...
>
> Stu
>
>



Relevant Pages

  • ADOrs from Oracle StoredProc. Cannot *correctly* pass params into db.
    ... knowledge when working with Oracle SP's. ... Dim sLOCN As String 'street/address number ... Dim objParam1 As New ADODB.Parameter ... street_no in varchar2, street_name in varchar2); ...
    (microsoft.public.vb.database.ado)
  • RE: ORA-01461 while moving data from sqlserver to oracle
    ... > I worte a conversion program which moves all data from SqlSrv to Oracle, ... I fill two Datatables using this ... > Dim sqlC as new SqlConnection ... > data.DataType) and to substring too long strings to ...
    (microsoft.public.dotnet.framework.adonet)
  • read meta data from Excel worksheet and load it into oracle reposi
    ... dispaly it in excel format, then load it into Oracle repository my table name ... Imports Oracle.DataAccess.Client ' ODP.NET Oracle data provider ... 'Public Class ConnectToExcelUsingSheetName ... Dim con1 As New ADODB.Connection ...
    (microsoft.public.vb.database)
  • Re: Oracle Sequence Jumps by 3 from Excel
    ... Dim adoCN As Object ... Dim adoRS As Object ... Dim lngX As Long ... Created an Oracle sequence to give me the next number, however, if i ...
    (microsoft.public.excel.programming)
  • Connecting to ODBC DB at startup
    ... Oracle tables in the table list, it asks for an id and pass. ... The problem is when I go to run a query or do anything else in the app ... Dim cnConn As ADODB.Connection ... Dim strLogin As String ...
    (comp.databases.ms-access)