|
-
November 25th, 2006, 01:08 AM
#1
No. of row effected in Update/Insert Query
Hi again,
Dear all, I am again in trouble with my project of billing solution.
In my project I have used some update and insert queries which modifies the raw data to calculate some billing effects. I want to show the number of rows effected on each update or insert query.
e.g. If I use insert query, it will insert the data into table (lets say 5 records). after completion of insert query i want to display the "5" in label1.caption
Short solution will be highly appreciated.
Umar
-
November 25th, 2006, 03:23 AM
#2
Re: No. of row effected in Update/Insert Query
Post your code so we can see where the problem *might* be
-
November 25th, 2006, 04:36 AM
#3
Re: No. of row effected in Update/Insert Query
Use an ADO connection object to .Execute the sql statement against your database. The second argument is the number or records affected.
Code:
Dim oCnn As ADODB.Connection
Dim lRecs As Long
Set oCnn = New ADODB.Connection
oCnn.Connectionstring"Your connectionstring to your database etc"
oCnn.Open
'Then execute your insert sql
oCnn.Execute "INSERT INTO Table1 VALUES('Test', 'Test2', Test3')", lRecs
label1.caption = lRecs & " Record(s) added to the database."
-
November 26th, 2006, 11:52 PM
#4
Re: No. of row effected in Update/Insert Query
working, u r gr8
can we do the same for select quries.
-
November 29th, 2006, 03:48 PM
#5
Re: No. of row effected in Update/Insert Query
With a select query you would be opening a recordset with the select statement as your source so you would depend on the .RecordCoutn property if your peovider supports it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|