473,382 Members | 1,204 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

ado connection errors

hi everyone,

i am using sql server 2005 to connect to a vb6 or earlier version app.
i appear to be having a problem with the connection string - i have been to http://www.connectionstrings.com with no luck.

my script looks as follows:
code looks as follows:

Expand|Select|Wrap|Line Numbers
  1. function LaunchApp()
  2. {
  3.   var result, Cmd; 
  4.  
  5.    sqlQryLaunchSDH = "select colname from table";
  6.  
  7.     openConnection();
  8.  
  9.     // Create a new object
  10.   Cmd = ADO.CreateADOCommand();
  11.   // Specify the command type
  12. //      Cmd.ActiveConnection = conn; = this is not supported
  13.  
  14.  
  15.       Cmd.CommandType = adCmdText;   
  16.  
  17.       // Specify the command text (the SQL expression)
  18.  
  19.       Cmd.CommandText = sqlQryLaunchSDH; //read in text qry
  20.  
  21.         // Execute the command
  22.  
  23.       result = Cmd.Execute(); //does not work Missing Connection or ConnectionString exception
  24.  
  25.  
  26. function openConnection()
  27. {
  28.   conn = ADO.CreateConnection();
  29.  
  30.   conn.ConnectionString = "Driver={SQL Native Client};Server=servername\\instancename;Database=dbname;Trusted_Connection=yes;";
  31.  conn.Open();
  32.  }
Initially i received the following error:

1] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I then changed the connection string however I then ended up with this error

2] Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done

3] Now with the code above I am able to make progress until I get to results = Cmd.Execute()

Where I get ‘Missing Connection or ConnectionString’ exception

anyone experience this problem before?
Mar 11 '08 #1
3 2386
jeffstl
432 Expert 256MB
hi everyone,

i am using sql server 2005 to connect to a vb6 or earlier version app.
i appear to be having a problem with the connection string - i have been to http://www.connectionstrings.com with no luck.

my script looks as follows:
code looks as follows:

Expand|Select|Wrap|Line Numbers
  1. function LaunchApp()
  2. {
  3.   var result, Cmd; 
  4.  
  5.    sqlQryLaunchSDH = "select colname from table";
  6.  
  7.     openConnection();
  8.  
  9.     // Create a new object
  10.   Cmd = ADO.CreateADOCommand();
  11.   // Specify the command type
  12. //      Cmd.ActiveConnection = conn; = this is not supported
  13.  
  14.  
  15.       Cmd.CommandType = adCmdText;   
  16.  
  17.       // Specify the command text (the SQL expression)
  18.  
  19.       Cmd.CommandText = sqlQryLaunchSDH; //read in text qry
  20.  
  21.         // Execute the command
  22.  
  23.       result = Cmd.Execute(); //does not work Missing Connection or ConnectionString exception
  24.  
  25.  
  26. function openConnection()
  27. {
  28.   conn = ADO.CreateConnection();
  29.  
  30.   conn.ConnectionString = "Driver={SQL Native Client};Server=servername\\instancename;Database=dbname;Trusted_Connection=yes;";
  31.  conn.Open();
  32.  }
Initially i received the following error:

1] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I then changed the connection string however I then ended up with this error

2] Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done

3] Now with the code above I am able to make progress until I get to results = Cmd.Execute()

Where I get ‘Missing Connection or ConnectionString’ exception

anyone experience this problem before?
This doesn't look like VB6.0 to me. This looks like a java or javascript or .NET framework stuff......

I can't tell where your specific problems are because your comments are overlapping to the next lines and its hard to tell if those are set up right. Also make sure conn is declared globally. Not sure other then that. sorry.
Mar 11 '08 #2
This doesn't look like VB6.0 to me. This looks like a java or javascript or .NET framework stuff......

I can't tell where your specific problems are because your comments are overlapping to the next lines and its hard to tell if those are set up right. Also make sure conn is declared globally. Not sure other then that. sorry.
Hi jeffstl
this is javascript but the app that this test script is running against is vb 6

function LaunchApp()
{
var conn, Cmd, result;

sqlQry = "select colname from table";

conn = ADO.CreateConnection();
conn.ConnectionString = "Driver={SQL Native Client};Server=servername\\instancename;Database=d bname;Trusted_Connection=yes;";
conn.Open();

Cmd = ADO.CreateADOCommand();
Cmd.CommandType = adCmdText;

Cmd.CommandText = sqlQry

result = Cmd.Execute();
}

At the point results = Cmd.Execute() I get ‘Missing Connection or ConnectionString’ exception regardless of where the connection string is sitting
Mar 19 '08 #3
QVeen72
1,445 Expert 1GB
Hi,

You Need to set Active Connection for Command object:

Set Cmd.ActiveConnection = Conn
Cmd.CommandType = adCmdText;
Cmd.CommandText = sqlQry

REgards
Veena
Mar 19 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem...
1
by: Frank Rizzo | last post by:
I have an app that has to connect to various data sources (ms sql server, sybase, etc...). For this reason I have OdbcConnection, OleDb Connection and SqlClient objects. When an error happens, I...
0
by: Steve - DND | last post by:
We are continually receiving timeout, and "Unable to write data to the transport connection" errors while using the System.Net.HttpWebRequest class from an ASP.Net web page. Below are the two...
4
by: Phil Townsend | last post by:
While we have switched to the Application.Data block to improve connection management, we are still experiencing connection pool errors on occasions. I have been careful to explicitly close...
1
by: Sean Nolan | last post by:
We have implemented unhandled error trapping at the application level and log these errors to our database. One error, however, the does not get trapped is when the connection pool has exceeded the...
18
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
7
by: Brad | last post by:
I have several web apps which download content to client (pdf, tif, etc) by writing out content in an aspx page. I've recently upgraded these from 1.1 to 2.0....and they all seem to work fine...
29
by: Bryce K. Nielsen | last post by:
Suddenly this week, I've started getting this error message: System.Data.SqlClient.SqlConnection(GetOpenConnection)ExecuteNonQuery requires an open and available Connection. The connection's...
0
bartonc
by: bartonc | last post by:
This is a work in progress (current and active). There are some issues to resolve in supporting multiple connection types and I plan to add PySQLite to the mix. The this update is due to my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.