Michael_St_Pete
16 years agoContributor
Receiving error message 'Microsoft OLE DB Provider for ODBC Drivers'
Using the section of code below, I am receiving an error message stating:
---------------------------
TestComplete
---------------------------
An exception occurred in the "sc_Common_Functions" unit at line 966:
Microsoft OLE DB Provider for ODBC Drivers
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
---------------------------
OK
---------------------------
The code previously worked and now is no longer working. What could be my problem? Below is the section of code where the issue occurs. The error occurs on the line: aCon["Open"]();.
function ReadInSQLData(TableName, Col1, Row1, Col2)
{
//This function reads in one piece of data from a table based on
//data from another column. ???This may not work if a third row of
//data is required (if more than two lines have the same data).
var aCon, aCmd, aRecSet, iRow, iColumn, Row2;
var MainColumn, ColumnToChoose;
// Creates ADO connection
aCon = ADO["CreateConnection"]();
// Sets up the connection parameters
aCon["ConnectionString"] = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Automation; Database=" + SQL_MainDatabase;
// Opens the connection
aCon["Open"]();
// Creates a command and specifies its parameters
aCmd = ADO["CreateCommand"]();
aCmd["ActiveConnection"] = aCon; // Connection
aCmd["CommandType"] = adCmdTable; // Command type
aCmd["CommandText"] = TableName; // Table name
// Opens a recordset
aRecSet = aCmd["Execute"]();
aRecSet["MoveFirst"]();
...
Mike
P.S. The same code works fine on a different computer.
---------------------------
TestComplete
---------------------------
An exception occurred in the "sc_Common_Functions" unit at line 966:
Microsoft OLE DB Provider for ODBC Drivers
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
---------------------------
OK
---------------------------
The code previously worked and now is no longer working. What could be my problem? Below is the section of code where the issue occurs. The error occurs on the line: aCon["Open"]();.
function ReadInSQLData(TableName, Col1, Row1, Col2)
{
//This function reads in one piece of data from a table based on
//data from another column. ???This may not work if a third row of
//data is required (if more than two lines have the same data).
var aCon, aCmd, aRecSet, iRow, iColumn, Row2;
var MainColumn, ColumnToChoose;
// Creates ADO connection
aCon = ADO["CreateConnection"]();
// Sets up the connection parameters
aCon["ConnectionString"] = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Automation; Database=" + SQL_MainDatabase;
// Opens the connection
aCon["Open"]();
// Creates a command and specifies its parameters
aCmd = ADO["CreateCommand"]();
aCmd["ActiveConnection"] = aCon; // Connection
aCmd["CommandType"] = adCmdTable; // Command type
aCmd["CommandText"] = TableName; // Table name
// Opens a recordset
aRecSet = aCmd["Execute"]();
aRecSet["MoveFirst"]();
...
Mike
P.S. The same code works fine on a different computer.