?
Solved

objConnextion.Execute and objRecordset.Open

Posted on 2004-08-18
9
Medium Priority
?
535 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

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

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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 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