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.
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.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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
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,
ie : objRecordset.Open SQL, Conn, 1, 3
1, 3 will set the mode to allow you to update fields with a recordset.
Cheers,
ASKER
darksinclair,
Thank you.
Why 2,2 not work? I need to lock the recordset.....
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!
Cheers, g/l in the rest of your coding!
ASKER
darksinclair,
Yes, I have found a few people can access it!!! I might have 100 visitors at the "same" time!
Yes, I have found a few people can access it!!! I might have 100 visitors at the "same" time!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
objRecordset.Open "INSERT INTO ...", objConnection, 3, 3