Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

objConnextion.Execute and objRecordset.Open

Posted on 2004-08-18
9
Medium Priority
?
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 320 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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
 
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 160 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 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