C# - ADODB - Failure to connect on deployment

A

Ames111

Hi

I have an application that connects to a SQl database on my computer
via an ADODB connection:

ADODB.Connection Conn = new ADODB.Connection();

Conn.ConnectionString = ("Driver={SQL
Server};Server=4P-12.Leighton.local;Database=HD;Uid=l0073;Pwd=cheese");

Conn.Open(dbconnection, "", "", -1);

ADODB.Recordset rs = new ADODB.Recordset();
rs.Open("SELECT * from [HD-Users]", Conn,
ADODB.CursorTypeEnum.adOpenStatic,
ADODB.LockTypeEnum.adLockBatchOptimistic, 1);

This works fine when running from the code, or even deploying it and
installing on my machine.

However whenever i install it on someone elses machine, it installs
fine, but when it gets to the part where it connects to the DB it fails
and says "Invalid connection string attribute"

Ive been looking about the net and all i really found was that in
c:\windows\assembly i have something called ADODB, but this isnt
present on the other machines ive installed it on.

Any ideas?
 
A

Ames111

Ok i changed it to the IP address but its timing out. i Also simplified
the connection to

ADODB.Connection Conn = new ADODB.Connection();
Conn.Open("Driver={SQL
Server};Server=xxx.xxx.xx.xx;Database=HD","l0073", "cheese",-1);
ADODB.Recordset rs = new ADODB.Recordset();


it seems to work on machines on the network that have ADODB in the
c:\windows\Assembly folder, and it doesnt work on machines that dont
have this.

Im pretty sure im deploying the application correctly, but im not sure
if its supposed to somehow put the ADODB 'THING' in the assembly folder
 
A

Ames111

fixed now. To get the ADODB in assembly i had to install it throught
the office 2003 setup as part of the .net framework for office....or
summit, it works anyway. thanks for your help
 
M

Marc Gravell

A bigger question would be: why, in C#, are you using ADODB? You should
probably be using ADO.Net, which is accessed via the System.Data
namespace... this avoids the interop hop, the prerequisite of ADODB, and is
just quicker...

e.g. (using the SqlClient provider)

using (System.Data.IDbConnection conn = new
System.Data.SqlClient.SqlConnection("your connection string")) {
conn.Open();
// and then use a data-reader or a data-set to get at your
data - see google...
}
 

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