Using ADODB in a Windows Form

G

Guest

I am trying to use ADO in a Windows form. It works as expected from the development computer running from Visual Studio. When I copy the exe to another computer, I get an error. Can someone either confirm this behavior or give me a way to solve problem. I posted this question before but got an answer that did not solve problem. Below are the exact steps that I performed from start of project to receipt of error.

(1) Open new Windows Application project in VS 1.1 on a development computer with XP Professional; (2) Add reference for C:\Program Files\Microsoft.NET\Primary Interop Assemblies\ADODB.dll; (3) Add line of code: Dim adoConn As New ADODB.Connection in the Declarations section of Form1.vb; (4) Compile in Release configuration; (4) Copy only file in bin folder (..\bin\winapp1.exe) from development computer to a laptop that contains Framework 1.1 and XP Home edition only; (5) launch the .exe on laptop. At this point I get "Application has generated...." error.

If I remark out the line of code in step #3 and repeat steps 4, 5, and 6, the form opens as expected on the laptop. Laptop is very new. Only preparation for executing .NET code was to download Framework 1.1. No other prep was performed on it.
 
G

Greg Burns

Have you installed MDAC on the laptop?

http://msdn.microsoft.com/data/Default.aspx


genojoe said:
I am trying to use ADO in a Windows form. It works as expected from the
development computer running from Visual Studio. When I copy the exe to
another computer, I get an error. Can someone either confirm this behavior
or give me a way to solve problem. I posted this question before but got an
answer that did not solve problem. Below are the exact steps that I
performed from start of project to receipt of error.
(1) Open new Windows Application project in VS 1.1 on a development
computer with XP Professional; (2) Add reference for C:\Program
Files\Microsoft.NET\Primary Interop Assemblies\ADODB.dll; (3) Add line of
code: Dim adoConn As New ADODB.Connection in the Declarations section of
Form1.vb; (4) Compile in Release configuration; (4) Copy only file in bin
folder (..\bin\winapp1.exe) from development computer to a laptop that
contains Framework 1.1 and XP Home edition only; (5) launch the .exe on
laptop. At this point I get "Application has generated...." error.
If I remark out the line of code in step #3 and repeat steps 4, 5, and 6,
the form opens as expected on the laptop. Laptop is very new. Only
preparation for executing .NET code was to download Framework 1.1. No other
prep was performed on it.
 
T

The Grim Reaper

For starters; change your line of code to;

Try
Dim adoConn As New ADODB.Connection
Catch ex As Exception
MessageBox.Show(ex.Message, "ADO Error")
End Try

.... and compile as before. This at the very least should give you (and us)
a bit more of a clue...
_____________________________
The Grim Reaper

genojoe said:
I am trying to use ADO in a Windows form. It works as expected from the
development computer running from Visual Studio. When I copy the exe to
another computer, I get an error. Can someone either confirm this behavior
or give me a way to solve problem. I posted this question before but got an
answer that did not solve problem. Below are the exact steps that I
performed from start of project to receipt of error.
(1) Open new Windows Application project in VS 1.1 on a development
computer with XP Professional; (2) Add reference for C:\Program
Files\Microsoft.NET\Primary Interop Assemblies\ADODB.dll; (3) Add line of
code: Dim adoConn As New ADODB.Connection in the Declarations section of
Form1.vb; (4) Compile in Release configuration; (4) Copy only file in bin
folder (..\bin\winapp1.exe) from development computer to a laptop that
contains Framework 1.1 and XP Home edition only; (5) launch the .exe on
laptop. At this point I get "Application has generated...." error.
If I remark out the line of code in step #3 and repeat steps 4, 5, and 6,
the form opens as expected on the laptop. Laptop is very new. Only
preparation for executing .NET code was to download Framework 1.1. No other
prep was performed on it.
 
G

Guest

Problem is solved. I needed to copy the ADODB.DLL to the laptop and place it in the same folder as the exe. I guess I thought that the .DLL would have been part of the installation of Framework 1.1 on the laptop. It is not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top