![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: DXL and Windows ADO database ? Topic Summary: Created On: 3-Feb-2003 17:34 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Missed it by thaaaatttt ('.') much! ![]() For those of you looking into this here is a working sample (you'll need the attached Access database and the ODBC drivers). | |
![]() |
|
Has anybody been able to get DOORS to use Windows ADO objects to access an ODBC database ? I've got one that is "nearly there" but oleGet and oleMethod seem to be lacking. The documentation for this is typical of DOORS and is sorely lacking. I'm hoping to hear back shortly from Support but figured I'd increase my chances.
In case you are curious about what/how I'm doing this here is an example of the code that uses an Access database. This is a tweak of some very basic VBScript to use DXL and opens the db, opens a recordset and then accesses it. I can use the "GetString" method and parse the data but it shouldn't need to be done. //* code starts here OleAutoObj oConn OleAutoObj oRst string vCS int records = 0 int state = 0 int iRec = 0 int lEOF = -1 string result = "" string sConn = "" string myText = "" string sField = "" OleAutoArgs autoArgs = create vCS = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\DOORS.MDB" oConn = oleCreateAutoObject("adodb.connection") oRst = oleCreateAutoObject("adodb.recordset") /* Connect to the database and open it */ olePut( oConn , "ConnectionString" , vCS ) oleMethod( oConn , "Open") oleGet( oConn , "ConnectionString" , sConn ) /* Attempt to open the record set */ olePut( oRst , "Source" , "Select * from DOORS" ) // query olePut( oRst , "CursorType" , 1 ) // forward cursor only olePut( oRst , "CursorLocation" , 3 ) // client cursor olePut( oRst , "Mode" , 1 ) // locking = readonly olePut( oRst , "ActiveConnection" , oConn ) // set connection oleMethod( oRst , "Open" ) oleGet( oRst , "State" , state ) infoBox "State = " state " "; // 1 = opened recordset ! oleGet( oRst , "RecordCount" , records ) infoBox "#records = " records "..."; // how many records were returned from the query oleMethod( oRst , "MoveLast") // go to the first record oleGet( oRst, "AbsolutePosition" , iRec ) // what is the record # ? infoBox "Current record = " iRec "" ; //oleMethod( oRst , "MoveLast") //oleMethod( oRst , "AddNew" ) // this -would- be the syntax to add // olePut( oRst , "fields(\"field01\")" , "bubba") // and save a record but it doesn't // olePut( oRst , "fields(\"field02\")" , "raul" ) // work either! //oleMethod( oRst , "Update" ) sField = "Fields(\"field01\")" // this should be the syntax to get a field's value! oleGet( oRst , sField , myText ) infoBox sField " = " myText ; // in VB it would be oRst("LastName") oleMethod( oRst , "MoveFirst") // move back to first to get all records! oleGet( oRst , "getstring" , myText ) //proof that this is getting the data! infoBox "Here is my proof:\n" myText "" ; // SO, WTF OVER ?!? Stream out = write "c:\\proof.txt" // write the data to a temporary file! out << myText; // close(out); // oleMethod(oRst, "close"); // Close the record set oleMethod(oConn, "close"); // Close the connection //* code ends here here |
|
![]() |
|
![]() |
|
I know absolutely nothing about ADO objects, but my guess would be that the problem is the syntax:
sField = "Fields(\"field01\")" // this should be the syntax to get a field's value! oleGet( oRst , sField , myText ) This is getting the Fields collection and then getting an element of the collection in one big step. Try breaking it down to two or three steps -- something like OleAutoObj oleFields oleGet( oRst, "Fields", oleFields) to get the fields collection as an object in itself, and then OleAutoArgs objArgBlock = null OleAutoObj oleField clear objArgBlock put(objArgBlock, "field01") oleMethod(oleFields, "Item", objArgBlock, oleField) // get the field object oleGet(oleField, "Value", myText) // get the value for the field Good luck, Judith |
|
![]() |
|
![]() |
|
Missed it by thaaaatttt ('.') much!
![]() For those of you looking into this here is a working sample (you'll need the attached Access database and the ODBC drivers). Edited: 6-Feb-2003 at 17:31 by Chris Welch |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
DXL and Windows ADO database ?
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.