By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,866 Members | 1,704 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,866 IT Pros & Developers. It's quick & easy.

Upgrade help (Interop Problems with DAO)

P: n/a
I'm having some Interop problems. I really need someone's
help on this, i'm running out of ideas. I have upgraded
my Data access controls to the latest ver.

Now then i have a form with these ref's:
Interop.DAO,System,System.Data,System.Drawing,Syst em.windo
ws.forms,System.XML.
all that's on this form is a button and when the button
is clicked it opens up a fox pro database and gets the
needed info/close. Now this works just fine on my
development PC. no errors/no probs. But when i move it
over to my win NT 4x machine it throws this err.

object ref not set to a instance of a object.
'Mod
Module UpgradeSupport
Friend DAODBEngine_definst As New DAO.DBEngine()
End Module
'click Evt for form1
Private Sub Command1_Click(ByVal eventSender As
System.Object, ByVal eventArgs As System.EventArgs)
Handles Command1.Click
MsgBox(GetLoanCode("RNM31025.DBF", 0))
End Sub

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try

' Loads the companies list information and
stores it in the
' collection complist
Dim db As DAO.Database
Dim tbl As DAO.Recordset
Dim tmpServer As String
Dim tmpRemoteSite As Boolean
Dim DAODBEngine_definst As New DAO.DBEngine()
'Set db = OpenDatabase
("\\serverc\c\datasys\", False, False, "FoxPro 2.5;")
db = DAODBEngine_definst.OpenDatabase
("C:\Complist\", False, False, "FoxPro 2.5;")
tbl = db.OpenRecordset("COMPLIST",
DAO.RecordsetTypeEnum.dbOpenSnapshot)
tbl.MoveLast()
tbl.MoveFirst()

Dim clsComplist As New CompanyList()

While Not tbl.EOF
If Trim(tbl.Fields("ID").Value & "")
<> "" Then
tmpServer = tbl.Fields
("Server").Value & ""
tmpRemoteSite = CBool(tbl.Fields
("RemoteSite").Value & "")
If tmpServer = "" Then tmpServer = "A"
clsComplist.GetCompanies.Add
(tbl.Fields("ID").Value, tbl.Fields("Billcode").Value
& "", tmpServer, CShort(tbl.Fields("RemoteType").Value
& ""), tmpRemoteSite)
tmpServer = ""
End If
tbl.MoveNext()
End While
MsgBox("done")
Catch
MsgBox(Err.Number & " " & Err.Description)
End Try
End Sub
'form1 info
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
Public Sub New()
MyBase.New()
If m_vb6FormDefInstance Is Nothing Then
If m_InitializingDefInstance
Then
m_vb6FormDefInstance
= Me
Else
Try
'For the
start-up form, the first instance created is the default
instance.
If
System.Reflection.Assembly.GetExecutingAssembly.En tryPoint
..DeclaringType Is Me.GetType Then

m_vb6FormDefInstance = Me
End If
Catch
End Try
End If
End If
'This call is required by the Windows
Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the
component list.
Protected Overloads Overrides Sub Dispose(ByVal
Disposing As Boolean)
If Disposing Then
If Not components Is Nothing
Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As
System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Command1 As
System.Windows.Forms.Button
'NOTE: The following procedure is required by
the Windows Form Designer
'It can be modified using the Windows Form
Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New
System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip
(Me.components)
Me.Command1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Command1
'
Me.Command1.BackColor =
System.Drawing.SystemColors.Control
Me.Command1.Cursor =
System.Windows.Forms.Cursors.Default
Me.Command1.Font = New System.Drawing.Font
("Arial", 8.0!, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Command1.ForeColor =
System.Drawing.SystemColors.ControlText
Me.Command1.Location = New System.Drawing.Point
(56, 96)
Me.Command1.Name = "Command1"
Me.Command1.RightToLeft =
System.Windows.Forms.RightToLeft.No
Me.Command1.Size = New System.Drawing.Size(185,
41)
Me.Command1.TabIndex = 0
Me.Command1.Text = "Command1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5,
13)
Me.ClientSize = New System.Drawing.Size(312, 209)
Me.Controls.AddRange(New
System.Windows.Forms.Control() {Me.Command1})
Me.Font = New System.Drawing.Font("Arial", 8.0!,
System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub
#End Region
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As Form1
Private Shared m_InitializingDefInstance As
Boolean
Public Shared Property DefInstance() As Form1
Get
If m_vb6FormDefInstance Is
Nothing OrElse m_vb6FormDefInstance.IsDisposed Then

m_InitializingDefInstance = True
m_vb6FormDefInstance
= New Form1()

m_InitializingDefInstance = False
End If
DefInstance =
m_vb6FormDefInstance
End Get
Set
m_vb6FormDefInstance = Value
End Set
End Property
#End Region

cheers.
--------------
:)

Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"john" <no****@email.com> schrieb
I'm having some Interop problems. I really need someone's
help on this, i'm running out of ideas. I have upgraded
my Data access controls to the latest ver.

Now then i have a form with these ref's:
Interop.DAO,System,System.Data,System.Drawing,Syst em.windo
ws.forms,System.XML.
all that's on this form is a button and when the button
is clicked it opens up a fox pro database and gets the
needed info/close. Now this works just fine on my
development PC. no errors/no probs. But when i move it
over to my win NT 4x machine it throws this err.

object ref not set to a instance of a object.


In which line?
--
Armin

Nov 20 '05 #2

P: n/a
The problem(s) are here

dbsource = DAODBEngine_definst.Workspaces(0).OpenDatabase
("C:\dbf\", False, False, "FoxPro 2.6;")
' Connecting to Table

tblSource = dbsource.OpenRecordset(sTableName,
DAO.RecordsetTypeEnum.dbOpenTable)
-----Original Message-----
"john" <no****@email.com> schrieb
I'm having some Interop problems. I really need someone's help on this, i'm running out of ideas. I have upgraded my Data access controls to the latest ver.

Now then i have a form with these ref's:
Interop.DAO,System,System.Data,System.Drawing,Syst em.windo ws.forms,System.XML.
all that's on this form is a button and when the button is clicked it opens up a fox pro database and gets the
needed info/close. Now this works just fine on my
development PC. no errors/no probs. But when i move it over to my win NT 4x machine it throws this err.

object ref not set to a instance of a object.


In which line?
--
Armin

.

Nov 20 '05 #3

P: n/a
here is a new error message.
this happens when i take out the vbHelper Mod and add
this in the method that opens the database.
Dim a As New DAO.DBEngine()
a.workspace(0)....

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040112):
Exception from HRESULT: 0x80040112.
at Project1.Form1.test(String& sTableName, Int16&
iNoDocuments)
at Project1.Form1.Button1_Click(Object sender,
EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp
(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage
(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc
(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///d:/winnt/microsoft.net/framework/v1.1.4322/mscorli
b.dll
----------------------------------------
Project1
Assembly Version: 1.0.1334.18831
Win32 Version: 1.0.1334.18831
CodeBase: file:///C:/Documents%20and%
20Settings/John/Desktop/test/upgraded/obj/Release/Project1
..exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///d:/winnt/assembly/gac/system.windows.forms/1.0.500
0.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///d:/winnt/assembly/gac/system/1.0.5000.0__b77a5c561
934e089/system.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase:
file:///d:/winnt/assembly/gac/microsoft.visualbasic/7.0.50
00.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:
file:///d:/winnt/assembly/gac/system.drawing/1.0.5000.0__b
03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
Interop.DAO
Assembly Version: 4.0.0.0
Win32 Version: 4.0.0.0
CodeBase: file:///C:/Documents%20and%
20Settings/John/Desktop/test/upgraded/obj/Release/Interop.
DAO.DLL
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file
for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms
section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

Nov 20 '05 #4

P: n/a
Hello,

"john" <no****@email.com> schrieb:
I'm having some Interop problems. I really need someone's
help on this, i'm running out of ideas. I have upgraded
my Data access controls to the latest ver.


Why don't use ADO .NET?

Regards,
Herfried K. Wagner
--
MVP VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.