Link to home
Start Free TrialLog in
Avatar of daveask
daveask

asked on

objConnextion.Execute and objRecordset.Open

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.
Avatar of j2nku
j2nku
Flag of Estonia image

Don't know, usually i'm using
objRecordset.Open "INSERT INTO ...", objConnection, 3, 3
SOLUTION
Avatar of neeraj523
neeraj523
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of daveask
daveask

ASKER

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

 
Avatar of daveask

ASKER

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
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,
Avatar of daveask

ASKER

darksinclair,

Thank you.
Why 2,2 not work? I need to lock the recordset.....
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!
Avatar of daveask

ASKER

darksinclair,

Yes, I have found a few people can access it!!! I might have 100 visitors at the "same" time!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial