Solved

objConnextion.Execute and objRecordset.Open

Posted on 2004-08-18
9
519 Views
Last Modified: 2008-01-09
Hi Experts,

Delete, Update and Insert into SQL can be used in
objConnection.Execute
They can also be used in
objRecordset.Open?
If thay are, is there any difference?

Thank you in advance.
0
Comment
Question by:daveask
9 Comments
 
LVL 7

Expert Comment

by:j2nku
ID: 11828966
Don't know, usually i'm using
objRecordset.Open "INSERT INTO ...", objConnection, 3, 3
0
 
LVL 22

Assisted Solution

by:neeraj523
neeraj523 earned 80 total points
ID: 11829002
Hello

Normally we use objConnection.Execute for executing update/insert statements.. where we don't need the out put in a recordset.. or we don't need to manuplate recordset default properties.. but when using select statement with objConnection.Execute.. it will restrict recordset generated by this method to only to the default properties of the recordset.. it means.. u wont able to chnage the cursor type/location of the recordset.. which wont allow you to use recordCount, absolutePosition, paging etc very usefull and powerfull properties of the recordset..

Ofcourse using objConnection.Execute for select statement is very quick to code and also takes mariginal less resources.. only when you are not required any recordset defailt property..

make sense ??

neeraj523
0
 

Author Comment

by:daveask
ID: 11829434
Thank you very much!

In my case, I need to do
  strSQL = "Delete * From Table1"
  objConnection.Execute strSQL
  strSQL = "Insert Into Table1([IP]) Values('" & userIP & "')"
  objConnection.Execute strSQL
do you think I can lock like this:
  objRecordset.Open "Delete * From Table1", objConnection, 2, 2
  objRecordset.AddNew
  objRecordset.Fields("IP") = userIP

 
0
 

Author Comment

by:daveask
ID: 11829827
In my case, I need to do
  strSQL = "Delete * From Table1"
  objConnection.Execute strSQL
  strSQL = "Insert Into Table1([IP]) Values('" & userIP & "')"
  objConnection.Execute strSQL
do you think I can lock like this:
  objRecordset.Open "Delete * From Table1", objConnection, 2, 2
  objRecordset.AddNew
  objRecordset.Fields("IP") = userIP
   objRecordset.Update     'I forgot this in the last post
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Expert Comment

by:darksinclair
ID: 11829923
that will work Daveask, just make sure when you are using objRecordset.Fields("IP") = userIP and then objRecordset.Update that you open your Recordset with the paramaters of 1,3.

ie : objRecordset.Open SQL, Conn, 1, 3

1, 3 will set the mode to allow you to update fields with a recordset.

Cheers,
0
 

Author Comment

by:daveask
ID: 11830227
darksinclair,

Thank you.
Why 2,2 not work? I need to lock the recordset.....
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 11831271
Daveask, why do you need to lock the recordset?  Nobody is going to be able to access it since you close it right after you are done.  Other combinations than 1,3 are useable, however, to keep your position and for the best results I've found I use 1,3.  always works for me.

Cheers,  g/l in the rest of your coding!
0
 

Author Comment

by:daveask
ID: 11831338
darksinclair,

Yes, I have found a few people can access it!!! I might have 100 visitors at the "same" time!
0
 
LVL 5

Accepted Solution

by:
darksinclair earned 40 total points
ID: 11831667
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adoce31/html/ado30ref_28.asp

This should answer any questions you have,
Let me know if I can be of any more assistance,

Cheers,
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now