Forum Discussion

Michael_St_Pete's avatar
15 years ago

Receiving error message 'Microsoft OLE DB Provider for ODBC Drivers'

Using the section of code below, I am receiving an error message stating:




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




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


// 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"]();




P.S.  The same code works fine on a different computer.

2 Replies

  • Our ODBC specialist worked with the code and found a workaround.  We do not know why this works, but it does.  According to the documentation the code is similar and should work the same.  The line:

    aCon["ConnectionString"] = "Provider=MSDASQL.1;Persist Security Info=False; Data Source=Automation; Database=" + SQL_MainDatabase;


    was changed to:

    aCon["ConnectionString"] = "Provider=sqloledb;Integrated Security=SSPI; Server=(local)\\P3Plus; Database=" + SQL_MainDatabase;

    Why would Test Complete complain about the first line, but be okay with the second line?


  • Hi,

    According to the exception you get, the problem is in the provider you're using. Probably, the appropriate DB driver is either not installed or corrupt on the problematic machine.