If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > ODBC ASE Driver v4.1 and RowsAffected / NOCOUNT query.. Help...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-18-02, 08:13
Rocks Rocks is offline
Registered User
 
Join Date: Sep 2002
Location: London
Posts: 8
Angry ODBC ASE Driver v4.1 and RowsAffected / NOCOUNT query.. Help...

Hi there, just joined the forum so if I should be posting this in another area then please excuse me and do let me know where....

I have an issue concerning the ASE ODBC DriversV4.1 on a Sybase 11.9.2 / 12 dB.

When using the drivers through a connection object created in VB I am unable to obtain the RowsAffected on any tables that have Insert/Update triggers working on. I have tried setting the NOCUNT property but have realised that the Update/insert succeeds but the trigger itself does not seem to have fired for those update/inserts.

Has anybody come across this or know where I can look to resolve this... If anyone would like to look at the trigger then 'm happy to forward it on.

Any help/Advice would be very appreciated.

Kind regards,
Reply With Quote
  #2 (permalink)  
Old 09-19-02, 13:23
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Are you looking to return the number of affected rows ? Does sybase support @@ROWCOUNT ?
Reply With Quote
  #3 (permalink)  
Old 09-19-02, 13:30
Rocks Rocks is offline
Registered User
 
Join Date: Sep 2002
Location: London
Posts: 8
it does but...

Quote:
Originally posted by rnealejr
Are you looking to return the number of affected rows ? Does sybase support @@ROWCOUNT ?
Hi, but the ASE V4.1 drivers do not return the rowsaffected which @@ ROWCOUNT would pass on.

[or have I completely lost the plot... would it be easier for me to send the trigger, It's been working fine but the issue I believe lies in the Drivers, but I'm having trouble finding out why]

Thanks,
rocks
Reply With Quote
  #4 (permalink)  
Old 09-19-02, 14:39
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Show me the snippet of code that is connecting and retrieving the results from sybase. What sql statements are you passing - are you using a stored procedure ?
Reply With Quote
  #5 (permalink)  
Old 09-20-02, 04:34
Rocks Rocks is offline
Registered User
 
Join Date: Sep 2002
Location: London
Posts: 8
Quote:
Originally posted by rnealejr
Show me the snippet of code that is connecting and retrieving the results from sybase. What sql statements are you passing - are you using a stored procedure ?
The VB code is below [althou i don't think the issue lies in here], a copy of the trigger is also attached.

Once again for your time in looking at this.

Public Function ExecuteSQL(strSQL As String, ErrOb As ADODB.Errors, RowsAff As Long) As Boolean

On Error GoTo ErrHandler

ADOcon.Execute strSQL, RowsAff

ExecuteSQL = True

Exit Function

ErrHandler:
Set ErrOb = ADOcon.Errors
ExecuteSQL = False

End Function
Attached Files
File Type: txt trigger.txt (19.3 KB, 97 views)
Reply With Quote
  #6 (permalink)  
Old 09-20-02, 20:06
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Have you been successful before using this driver and returning row affected (exactly like you are doing now) ? Have you tested creating a database/table without triggers to see if it works ?

Let me know - I might have a solution.
Reply With Quote
  #7 (permalink)  
Old 09-23-02, 09:24
Rocks Rocks is offline
Registered User
 
Join Date: Sep 2002
Location: London
Posts: 8
Quote:
Originally posted by rnealejr
Have you been successful before using this driver and returning row affected (exactly like you are doing now) ? Have you tested creating a database/table without triggers to see if it works ?

Let me know - I might have a solution.
Thanks for your reply, I've not been successful at at with getting back the RowsAff with this driver connecting to tables with triggers.
Tables without triggers are fine, they return the Rowsaff as expected.

What have you in mind..?
Reply With Quote
  #8 (permalink)  
Old 09-23-02, 13:10
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Add select @@rowcount at the end of your query. In your code, create a recordset object. When you run this query, 2 recordsets will be returned - the 2nd being the value you are looking for. Move to the 2nd recordset and use the rs(0) to return the value. Let me know how it goes.
Reply With Quote
  #9 (permalink)  
Old 09-23-02, 13:36
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Do the following:

select * from table;select @@rowcount

I am not sure about sybase's character but try the semi-colon between the 2 statements.
Reply With Quote
  #10 (permalink)  
Old 09-24-02, 18:32
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Any luck? Did you try rs.nextrecordset ?
Reply With Quote
  #11 (permalink)  
Old 10-30-02, 08:17
PremierJP PremierJP is offline
Registered User
 
Join Date: Oct 2002
Posts: 5
Thumbs up rnealejr

rnealjr... thanks for the info. I ran into the same problem and your solution worked fine. Thanks
Reply With Quote
  #12 (permalink)  
Old 10-30-02, 17:14
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
PremierJP,

Happy to help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On