dbOpenConnection - Function not defined

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
zscriven
Posts:21
Joined: Tue Jul 05, 2016 11:03 pm

dbOpenConnection - Function not defined

Post by zscriven »

I am working on a WinCC OA 3.14 patch 4 project. I was able to get the rdb.ctl library to connect to a SQL server database in a test project. However when I create a new project I cannot for the life of me get the thing to work.

Everytime I call rdbOpen I get an error message.

Code: Select all

WCCOAui      (1), 2016.08.03 10:23:38.103, CTRL, SEVERE,    176, Uncaught exception in thread started at main: 
WCCOAui      (1), 2016.08.03 10:23:38.103, CTRL, SEVERE,     72, Function not defined, 
    Module: _QuickTest_
    Panel: C:\\WinCC_OA_Proj\\MESLite\\panels\\SQL Testing.pnl []
    Object: 1 named: "btnQuery" of type: PUSH_BUTTON
    Script: Clicked
    Library: C:\\WinCC_OA_Proj\\MESLite\\scripts\\libs\\rdb.ctl
    Line: 75, dbOpenConnection
	Stacktrace:
	     1: rdbOpen(dbConnection & c = , string rdb = "") at rdb.ctl:75
	     2: updateTable() at [Module: _QuickTest_ Panel: SQL Testing.pnl ScopeLib: SQL Testing.pnl]:17
	     3: main() at [Module: _QuickTest_ Panel: SQL Testing.pnl Object: btnQuery Script: Clicked]:6
Here is my code. Note that I do have a default DSN provider in my rdb.ctl and it has worked.

Code: Select all

#uses "rdb.ctl"
// called from a button on the screen
updateTable()
{
  
  dbConnection    db;
  dyn_dyn_anytype result;
  string sqlQuery = "SELECT * FROM wincc.dbo.statusCodes";
  
  
  // Open db connection
  rdbOpen(db);
  
  // query the database
  rdbSelect(db, sqlQuery, result);
  
  //DebugN(result);
  
  // Close db connection
  rdbClose(db);
}

mkoller
Posts:741
Joined: Fri Sep 17, 2010 9:03 am

Re: dbOpenConnection - Function not defined

Post by mkoller »

insert
#uses "CtrlADO"
as the first line of your script.

zscriven
Posts:21
Joined: Tue Jul 05, 2016 11:03 pm

Re: dbOpenConnection - Function not defined

Post by zscriven »

Thank you! That was it.

3 posts • Page 1 of 1