mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2004
Posts: 759
M
Hoopy frood
OP Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
ADODB method
Code:
  
   .comopen objConnection ADODB.Connection
    !.echo -q $com(objConnection, Open, 1, *bstr, Provider=Microsoft.JET.OLEDB.4.0;Data Source=C:\mIRC\Test.mdb)

    .comopen objRecordset ADODB.Recordset
    !.echo -q $com(objRecordset, Open, 1, *bstr, SELECT * FROM TableName WHERE TableID = 1, dispatch, objConnection)

    ; Drill down to the field we want the data from, object by object.
    !.echo -q $com(objRecordset, Fields, 2, dispatch* objFields)
    !.echo -q $com(objFields, Item, 2, *bstr, Nickname, dispatch* objNickname)
    !.echo -q $com(objNickname, Value, 2)
    set %Nickname $com(objNickname).result
    WHILE $com(1) { .comclose $ifmatch   } 

gets me this error
"* No such Com 'objNickname' open (line 90, sysancore.mrc)""

the Zodbc.dll method
Code:
      set %odbc.dll " $+ $scriptdir $+ Zodbc.dll"
    echo -a $dll(%odbc.dll,AddNewDataSource,Driver do Microsoft Access (*.mdb)$DSN=test$UID=test$PWD=test$DBQ= $+ $scriptdir $+ \example.mdb)
    echo -a Create: $dll(%odbc.dll,Create,example <->)
    echo -a Connect: $dll(%odbc.dll,Connect,example test:test:test)

    echo -a INSERT 1:: $dll(%odbc.dll,Execute,example INSERT INTO example(texte) VALUES('OS: $os $+ ');)
    echo -a INSERT 2:: $dll(%odbc.dll,Execute,example INSERT INTO example(texte) VALUES('Nick: $me $+ ');)
    echo -a INSERT 3:: $dll(%odbc.dll,Execute,example INSERT INTO example(texte) VALUES('IP: $ip $+ ');)
    echo -a INSERT 4:: $dll(%odbc.dll,Execute,example INSERT INTO example(texte) VALUES('Serveur: $server $+ ');)

    echo -a SELECT:: $dll(%odbc.dll,Execute,example SELECT * FROM example;)
    echo -a DELETE:: $dll(%odbc.dll,Execute,example DELETE FROM example;)

    echo -a Commit: $dll(%odbc.dll,Commit,example)
    echo -a Disconnect: $dll(%odbc.dll,Disconnect,example)
    echo -a Free: $dll(%odbc.dll,Free,example) 

gets me this error and this is straight copied from the example .mrc packed with the zodbc.dll.

S_OK
Create: S_OK:SLOT_1
Connect: ERR:IMPOSSIBLE_TO_CONNECT
INSERT 1:: ERR:BAD_DATABASE
INSERT 2:: ERR:BAD_DATABASE
INSERT 3:: ERR:BAD_DATABASE
INSERT 4:: ERR:BAD_DATABASE
SELECT:: ERR:BAD_DATABASE
DELETE:: ERR:BAD_DATABASE
Commit: ERR:DATABASE_IS_NOT_CONNECTED
Disconnect: ERR:DATABASE_IS_NOT_CONNECTED
Free: S_OK


Has anyone ever done this/got it working/know how this is fixed ?
or know of any other methods ? id love to be able to get this working. Thanks in advance.


$maybe
Joined: Apr 2005
Posts: 4
K
Self-satisified door
Offline
Self-satisified door
K
Joined: Apr 2005
Posts: 4
Probably because of this line:

set %Nickname $com(objNickname).result

set %nickname $com(objRecordset).result

Now where do i get zobdc.dll??

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
This is because the Fields COM object only takes a numeric index, not a string.

Change your SQL statement to read SELECT Nickname FROM TableName WHERE TableID = 1
and then use $com(objFields, Item, 2, int, 0) to retrieve the value stored in that field. You can
also use the Collect method on the objRecordset without creating the objFields using
$com(objRecordset, Collect, 2, int, 0) - remember that the index starts at zero instead of one.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard