Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

I need a Help in vb6

Visual Basic 4 / 5 / 6

  • Please log in to reply
3 replies to this topic

#1 msrajamca

msrajamca

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 10 September 2008 - 01:55 AM

Hai,

I am new in vb6. Now i was started a programe for developing Granite Processing System. For that i have lot of problems.

For ex:

If i click the save button, it will execute all queries i am writing. it is having 5 insert statement. after completing 3 queries i have an error for some thing. Execute all five queries without an error this is exexute. Inbetween any errror will occur i will be remove the last transaction.


How to Use the transactions.
  • 0

#2 Xav

Xav

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 8356 posts

Posted 10 September 2008 - 12:23 PM

What's the error message?
  • 0
If you enjoy reading this discussion and are thinking about commenting, why not click here to register and start participating in under a minute?

#3 mbshinde78

mbshinde78

    CC Newcomer

  • Just Joined
  • PipPip
  • 19 posts

Posted 15 September 2008 - 03:10 AM

I think you can use begintrans and committrans. This will allow you to either insert all transactions or insert none.
  • 0

#4 Colanth

Colanth

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 165 posts
  • Location:Fayetteville, NC, USA
  • Programming Language:PHP, (Visual) Basic, JavaScript, Visual Basic .NET, Pascal, Logo, Assembly, VBScript, Others

Posted 22 September 2012 - 07:28 PM

set a boolean (say bError) to False
begin the transaction
do your inserts here
after each insert, if there's any error set bError to True)
after all the inserts, if bError is false
commit the transaction
else
roll back the transaction (and give the user some indication of what happened)
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download