Connect to SQL Server 2005 Problem

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi all,

I have created an Outlook Add-in using VS2005, which basically
populates a custom WinForm with some data retrived from the backend SQL
Server 2005 database.

The SQL Server is installed on the same computer as the development
environment (VS 2005).

The add-in code compiles OK and I have created a setup package for this
app, which installs the required files with no problem. The package has
been tested working on the development machine. But as soon as I
install it on another computer (installation was no problem, and
outlook launched the add-in as expected) and click on the add-in button
I made on the menu bar, the add-in hangs up.

I checked the tables on the sql server, no operations was performed
whatsoever. Suspecting there are errors connecting to the server, I
also threw in some Try - Catch pairs to catch the exceptions, but still
nothing pops up as if the app couldn't even start while it runs just
fine on the development machine.

Below is how I connect to the SQL Server 2005 in my code (VB)

Dim cn As ADODB.Connection = New Connection
Dim rst As Recordset, query As String
cn.ConnectionString =
"Provider=SQLNCLI;Server=Development;Database=Project1;Trusted_Connection=yes;"
cn.Open()

query = "SELECT * FROM Sample_Tab;"
''' Do something with the connection
Try
rst = cn.Execute(query)
Catch ex As Exception
MsgBox("ADODB Error: " & ex.ToString)
Exit Sub
End Try

cn.Close()

Any help will be greatly appreciated.


-rahx

.


Quantcast