Solved

objConnextion.Execute and objRecordset.Open

Posted on 2004-08-18
9
529 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 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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