borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Searching)Next Topic (Public Function call) New Topic New Poll Post Reply
AndreaVB Forum : Database : Validating con.execute statement Solved Topic
Poster Message
di_2006
Level: Protégé

Registered: 03-03-2006
Posts: 4

icon Validating con.execute statement

I am using VB6.0 as the front-end with MS Access 2003 as the back-end for my project.

I have an insert statement to insert an entry in the database. I use
Con.execute sql1,,adExecuteNoRecords

Now, I want to validate my form. I want to display a Success message if the insertion statement is executed successfully; else I want to display an error message to the user. How do I check if con.execute really works??

Please help...

Thanks in advance  

04-03-2006 at 04:52 AM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: Validating con.execute statement

Hi again

As Goran pointed out, you can get the number of records affected by using the below code.

Dim RecordsAffected as long

connection.Execute CommandText, RecordsAffected, Options


Then you can do
If RecordsAffected = 0 then
    msgbox "Nothing done"
else
    msgbox RecordsAffected & " Records inserted / Updated"
endif


Steve  

04-03-2006 at 12:28 PM
View Profile Send Email to User Show All Posts | Quote Reply
di_2006
Level: Protégé

Registered: 03-03-2006
Posts: 4
icon Re: Validating con.execute statement

Hey thnks once again,steve.It worked.

Thanks to everyone here for your quick replies.I'm glad I found this site...

07-03-2006 at 09:46 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Validating con.execute statement Solved Topic
Previous Topic (Searching)Next Topic (Public Function call) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder