Fatal Error, using VB .NET + ADO .NET 
Author Message
 Fatal Error, using VB .NET + ADO .NET

I'd deeply appreciate if any one would give me a hand.

I am developing VB. NET App. with following tools
Microsoft Visual Studio .NET Version 7.0.9466
Microsoft .NET Frmework 1.0 Version 1.0.3705
Windows XP Version 5.1.2600 Service Pack 1 Bulid 2600
Database Server : Sysbase Anywhere

I wrote a Class, with a OleDataadapter, datacommand,
Inside, I have a Sub,
input : a SQL Query String,
output : a DataTable

I'd bind the datatable to datagrid , some with populate on the screen.

Since I think that using my own method is more flexible and easiler to
control.
(As many Microsoft provided turtorial is attach a DataAdapter to Each Form,
that would not so efficient)

Now MY PROBLEM IS
I face a occasionally Fatal exception, sometimes is :

#########
An unhandled exception of type 'System.NullReferenceException' occurred in
system.windows.forms.dll
Additional information: Object reference not set to an instance of an
object.
##########

or sometimes got other message , something like ExecutionEngine Exception

But the De{*filter*} don't point out exactly which line of code cause that
exception.

sometimes would point to a not related code,
for example :

  Text1.text = "0"

This Fatal error is not happen everytime I run the program ,
More offen at Debugging mode
sometimes at Release execution mode.

the following is part of my class file

Public Class clsDB
    Const CN_STR = "#####connection string aoo?e###"
    WithEvents cnDB As New System.Data.OleDb.OleDbConnection(CN_STR)
    WithEvents adDB As New System.Data.OleDb.OleDbDataAdapter()
    Dim cmSQL As New OleDb.OleDbCommand()

    Public Sub QueryDB(ByVal strQuery As String, ByRef dtUser As
Data.DataTable, Optional ByVal oleTransaction As OleDb.OleDbTransaction =
Nothing)
        Dim dtDB As New Data.DataTable()
        Try
            If (oleTransaction Is Nothing) <> True Then
                cmSQL.Connection = oleTransaction.Connection
                cmSQL.CommandText = strQuery
                adDB.SelectCommand = cmSQL
            Else
                cmSQL.CommandText = strQuery
                cmSQL.Connection = cnDB
                adDB.SelectCommand = cmSQL
            End If

            adDB.Fill(dtUser)

        Catch ex As Exception
            Throw ex
        End Try

    End Sub

THANK YOU SO MUCH, INDEED.



Tue, 16 Aug 2005 19:30:39 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ADO.NET with ASP.NET using VB.NET

2. what create table using ADO.NET to VB.NET

3. I can not INSERT into Access95 using ADO.net and VB.NET

4. Using VB.Net, ADO.Net and Access

5. INSERT into access database using vb.net/ado.net..problem

6. ADO.Net to fetch ActiveDirectory this function bugs in Asp.net but works in Vb.n

7. VB.Net, Classes and ADO.Net guidelines???

8. VB.Net => Ado.Net = Stored Procedure

9. Memory leak! (ADO.NET, VB.NET)

10. vb.net / ado.net design question

11. ADO.net VB.net and Oracle

12. VB.Net and Ado.Net Help Please!!!!

 

 
Powered by phpBB® Forum Software