Ask a Question

Throwing error on the DB table

SOLVED
mcmprashanth
Occasional Contributor

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();
 }

  • IE
2 REPLIES 2
ebarbera
Staff

Hi @mcmprashanth - 

 

It looks to me like you need to specify the table name when opening the table connection:

 

see example here:

https://support.smartbear.com/testcomplete/docs/reference/program-objects/ado/createadotable.html

 

Let me know if you have further questions.

 

Emma

sonya_m
SmartBear Alumni (Retired)

Thank you, Emma!

 

Hi @mcmprashanth! Does this advice help? 


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: