Unable to connect to oracle db
I am getting unspecified error on line Qry1.Open()
Below is the snippet of the code:-
function pdfname() {
var Qry1;
// Create a query
Qry1 = ADO.CreateADOQuery();
// Specify the connection string
Qry1.ConnectionString = "Driver={Microsoft ODBC for Oracle}; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxx)(PORT=xx))(CONNECT_DATA=(SERVICE_NAME=xxxxxxx))); uid=xxxx;pwd=xxxx;";
// Specify the SQL expression
Qry1.SQL = "Select * FROM table1 WHERE comm_code = 'COT'";
// Execute the query
Qry1.Open();
// Process results and insert data into the test log
Qry1.First();
while (!Qry1.EOF) {
Log.Message(Qry1.FieldByName("columnname").Value);
Qry1.Next();
}
// Closes the query
Qry1.Close();
}
I suspect, but am not certain, it's in your query expression. Change it to the following to ensure that the single quote character actually translates properly.
Qry1.SQL = "Select * FROM table1 WHERE comm_code = \'COT\'";