Forum Discussion

mcmprashanth's avatar
mcmprashanth
Occasional Contributor
4 years ago

Throwing error on the DB table

Hi, Can someone suggest why testcomplete is throwing error on my table name statement (aCmd.CommandText = "account_name") as "Invalid object name".

It appears to connect to DB fine as aCon.State is returning as 1. Not sure why it isn't accepting the table name.

 

  aCon = ADO.CreateConnection();
  // Sets up the connection parameters
  aCon.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=XXXXXXX;Data Source=XXXX";
  // Opens the connection
  aCon.Open();
  Log.Message(aCon.State);
  // Creates a command and specifies its parameters
  aCmd = ADO.CreateCommand();
  aCmd.ActiveConnection = aCon; // Connection
  aCmd.CommandType = adCmdTable;
   // Command type
  aCmd.CommandText = "account_name"; // Table name
  // Opens a recordset
  aRecSet = aCmd.Execute();
  aRecSet.MoveFirst();
 }