URGENT HELP ADODB VbScript vs ADODB.ConnectionClass() C#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

ok this is the craziest thing every. I have a piece of code that connects to a dsn database. I have tested the connection two different ways

************************ONE
using ADODB;
ADODB.Connection dbSupra = new ADODB.ConnectionClass();
dbSupra.Open("DSN=112","urs","pss",0);
************************TWO
using System.Data.OleDb;
OdbcConnection dbSupra = new OdbcConnection();
dbSupra.ConnectionString = "DSN=112;UID=urs;PWD=pss";
dbSupra.Open();

run the web page from my development web server which is inside our network and works like a charm. PERFECT

now I upload the exact same code to my production web server which is in between our network and a pix and =( doesnt work error
Exception Details: System.Runtime.InteropServices.COMException: Unspecified error WHY??????????!!!!!!!!!!

now I did this crazy test I build an asp page using vbscript
<%@ language=VBSCRIPT%>
<%
set db=Server.CreateObject("adodb.Connection")
dbSupra.Open("DSN=112","urs","pss",0);

this WORKS both in my dev web server and my production web server.

So first i thought is was the firewall setting but then why does the vbscript code can connect to the server.

PLEASE some enlightening would be appreciated

Silvia Brunet Jones
Programmer Analyst, MCSD.NET\MCDBA
 
Did you set up the DSN on the server, as well.

NOTE: If you can move away from DSNs, it is the wisest option, as they are
perf pigs.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
Silvia Brunet Jones said:
ok this is the craziest thing every. I have a piece of code that connects
to a dsn database. I have tested the connection two different ways
************************ONE
using ADODB;
ADODB.Connection dbSupra = new ADODB.ConnectionClass();
dbSupra.Open("DSN=112","urs","pss",0);
************************TWO
using System.Data.OleDb;
OdbcConnection dbSupra = new OdbcConnection();
dbSupra.ConnectionString = "DSN=112;UID=urs;PWD=pss";
dbSupra.Open();

run the web page from my development web server which is inside our
network and works like a charm. PERFECT
now I upload the exact same code to my production web server which is in
between our network and a pix and =( doesnt work error
Exception Details: System.Runtime.InteropServices.COMException:
Unspecified error WHY??????????!!!!!!!!!!
now I did this crazy test I build an asp page using vbscript
<%@ language=VBSCRIPT%>
<%
set db=Server.CreateObject("adodb.Connection")
dbSupra.Open("DSN=112","urs","pss",0);

this WORKS both in my dev web server and my production web server.

So first i thought is was the firewall setting but then why does the
vbscript code can connect to the server.
 
Quick question: Are you doing this in an ASP.NET page or an ASP page?

If you are using ASP.NET, why are you using ADODB? Try moving your code over
to System.Data.SqlClient or System.Data.OleDB. At least that way you aren't
left with the cryptic COMExceptions and you might be able to better
troubleshoot the exception that is being raised.

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

message | yes the dsn is set up. I am not sure though how could I get away from it
since that is the only way I am able to connect to the db
|
| "Cowboy (Gregory A. Beamer) [MVP]" wrote:
|
| > Did you set up the DSN on the server, as well.
| >
| > NOTE: If you can move away from DSNs, it is the wisest option, as they
are
| > perf pigs.
| >
| > --
| > Gregory A. Beamer
| > MVP; MCP: +I, SE, SD, DBA
| >
| > ************************************************
| > Think Outside the Box!
| > ************************************************
| > "Silvia Brunet Jones" <[email protected]>
wrote in
| > message | > > ok this is the craziest thing every. I have a piece of code that
connects
| > to a dsn database. I have tested the connection two different ways
| > >
| > > ************************ONE
| > > using ADODB;
| > > ADODB.Connection dbSupra = new ADODB.ConnectionClass();
| > > dbSupra.Open("DSN=112","urs","pss",0);
| > > ************************TWO
| > > using System.Data.OleDb;
| > > OdbcConnection dbSupra = new OdbcConnection();
| > > dbSupra.ConnectionString = "DSN=112;UID=urs;PWD=pss";
| > > dbSupra.Open();
| > >
| > > run the web page from my development web server which is inside our
| > network and works like a charm. PERFECT
| > >
| > > now I upload the exact same code to my production web server which is
in
| > between our network and a pix and =( doesnt work error
| > > Exception Details: System.Runtime.InteropServices.COMException:
| > Unspecified error WHY??????????!!!!!!!!!!
| > >
| > > now I did this crazy test I build an asp page using vbscript
| > > <%@ language=VBSCRIPT%>
| > > <%
| > > set db=Server.CreateObject("adodb.Connection")
| > > dbSupra.Open("DSN=112","urs","pss",0);
| > >
| > > this WORKS both in my dev web server and my production web server.
| > >
| > > So first i thought is was the firewall setting but then why does the
| > vbscript code can connect to the server.
| > >
| > > PLEASE some enlightening would be appreciated
| > >
| > > Silvia Brunet Jones
| > > Programmer Analyst, MCSD.NET\MCDBA
| > >
| >
| >
| >
 
As you can see on my example code I have tried both ADODB and the System.Data.Odbc. I am trying to do this in an ASP.NET page, however it doesnt work. If I do it with a simple ASP page it works Using the System.Data.Odbc give me this error
System.Data.Odbc.OdbcException: ERROR - no error information available

I just dont understand why it works in a simple asp page and not on the asp.net page
 
As you can see on my example code I have tried both ADODB and the System.Data.Odbc. I am trying to do this in an ASP.NET page, however it doesnt work. If I do it with a simple ASP page it works Using the System.Data.Odbc give me this error
System.Data.Odbc.OdbcException: ERROR - no error information available

I just dont understand why it works in a simple asp page and not on the asp.net page
 
As you can see on my example code I have tried both ADODB and the System.Data.Odbc. I am trying to do this in an ASP.NET page, however it doesnt work. If I do it with a simple ASP page it works Using the System.Data.Odbc give me this error
System.Data.Odbc.OdbcException: ERROR - no error information available

I just dont understand why it works in a simple asp page and not on the asp.net page
 
Well, all that I can find on this has to do with ODBC is this
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q319243

This is where I would start to compare versions of MDAC and odbc32.dll
between your workstation and your server. I have a feeling that you may have
newer versions on your workstation.

Above all, I would make sure that you *need* to be using OleDB vs.
SqlClient. If you are going against a Sql Server, I would strongly recommend
using SqlClient (or for Oracle, there is now a managed OO provider that is
much better than ADODB or OleDb).

--
HTH

Kyril Magnos
"I'm not a developer anymore, I'm a software engineer now!" :-)

message | As you can see on my example code I have tried both ADODB and the
System.Data.Odbc. I am trying to do this in an ASP.NET page, however it
doesnt work. If I do it with a simple ASP page it works Using the
System.Data.Odbc give me this error
| System.Data.Odbc.OdbcException: ERROR - no error information available
|
| I just dont understand why it works in a simple asp page and not on the
asp.net page
|
|
| "Kyril Magnos" wrote:
|
| > Quick question: Are you doing this in an ASP.NET page or an ASP page?
| >
| > If you are using ASP.NET, why are you using ADODB? Try moving your code
over
| > to System.Data.SqlClient or System.Data.OleDB. At least that way you
aren't
| > left with the cryptic COMExceptions and you might be able to better
| > troubleshoot the exception that is being raised.
| >
| > --
| > HTH
| >
| > Kyril Magnos
| > "I'm not a developer anymore, I'm a software engineer now!" :-)
| >
| > "Silvia Brunet Jones" <[email protected]>
wrote in
| > message | > | yes the dsn is set up. I am not sure though how could I get away from
it
| > since that is the only way I am able to connect to the db
| > |
| > | "Cowboy (Gregory A. Beamer) [MVP]" wrote:
| > |
| > | > Did you set up the DSN on the server, as well.
| > | >
| > | > NOTE: If you can move away from DSNs, it is the wisest option, as
they
| > are
| > | > perf pigs.
| > | >
| > | > --
| > | > Gregory A. Beamer
| > | > MVP; MCP: +I, SE, SD, DBA
| > | >
| > | > ************************************************
| > | > Think Outside the Box!
| > | > ************************************************
| > | > "Silvia Brunet Jones" <[email protected]>
| > wrote in
| > | > message | > | > > ok this is the craziest thing every. I have a piece of code that
| > connects
| > | > to a dsn database. I have tested the connection two different ways
| > | > >
| > | > > ************************ONE
| > | > > using ADODB;
| > | > > ADODB.Connection dbSupra = new ADODB.ConnectionClass();
| > | > > dbSupra.Open("DSN=112","urs","pss",0);
| > | > > ************************TWO
| > | > > using System.Data.OleDb;
| > | > > OdbcConnection dbSupra = new OdbcConnection();
| > | > > dbSupra.ConnectionString = "DSN=112;UID=urs;PWD=pss";
| > | > > dbSupra.Open();
| > | > >
| > | > > run the web page from my development web server which is inside
our
| > | > network and works like a charm. PERFECT
| > | > >
| > | > > now I upload the exact same code to my production web server which
is
| > in
| > | > between our network and a pix and =( doesnt work error
| > | > > Exception Details: System.Runtime.InteropServices.COMException:
| > | > Unspecified error WHY??????????!!!!!!!!!!
| > | > >
| > | > > now I did this crazy test I build an asp page using vbscript
| > | > > <%@ language=VBSCRIPT%>
| > | > > <%
| > | > > set db=Server.CreateObject("adodb.Connection")
| > | > > dbSupra.Open("DSN=112","urs","pss",0);
| > | > >
| > | > > this WORKS both in my dev web server and my production web server.
| > | > >
| > | > > So first i thought is was the firewall setting but then why does
the
| > | > vbscript code can connect to the server.
| > | > >
| > | > > PLEASE some enlightening would be appreciated
| > | > >
| > | > > Silvia Brunet Jones
| > | > > Programmer Analyst, MCSD.NET\MCDBA
| > | > >
| > | >
| > | >
| > | >
| >
| >
| >
 
The DSN was a good idea, as it made development very easy in an age where
the data access method was hard. When you use a DSN, however, you are going
through ODBC, rather than OLEDB or native. ODBC is nice and easy, but it is
horribly slow and buggy. When something is overly generic, it ends up being
slow.

To connect, I would move to OLEDB at the very least. If you are using Oracle
or SQL Server, I would use the native provider. Either way, here is a link
for setting up connection strings:
http://www.able-consulting.com/ADO_Conn.htm

You will move away from System.Data.ODBC and move to System.Data.OleDb (or
SqlClient or OracleClient, if using one of those).

Benefits:
1. Less errors
2. Much better performance

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
Silvia Brunet Jones said:
yes the dsn is set up. I am not sure though how could I get away from it
since that is the only way I am able to connect to the db
 
I would have her move off ODBC, if possible. The OleDb providers are much
more stable and perform better. This link has ways of setting up conn
strings in ADO.NET:
http://www.able-consulting.com/ADO_Conn.htm

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
Back
Top