|
Posted by Tonio Tanzi on 06/02/07 15:09
Erland Sommarskog ha scritto:
> The most likely reason for your problem is that you are not running with
> SET NOCOUNT ON, and when you fail to pick up the rowcount, ADO opens a
> second connection behind your back, and then you block yourself.
>
> However, the code you have is not very good. There is no reason to run
> a loop to get all data up to the client just to shove it back again.
> You can copy all in one statement. Furthermore you should learn to
> use parameterised commands and stop interpolating parameters directly
> into your SQL strings.
>
> cmd.txt = "INSERT detail(id, data, sede, esecutori, brani_autori) " & _
> "SELECT ?, data, sede, esecutori, brani_autori " & _
> "FROM detail " & _
> "WHERE id = ?"
> cmd.CreateParameter "@new_master_id", adGUID, adParamInput,, new_id_master
> cmd.CreateParameter "@new_master_id", adGUID, adParamInput,, old_id_master
> cmd.Execute
Thanks for the help and the explanation, I've solved with this query:
insert into detail (id, data, sede, esecutori, brani_autori)
select new_id_master, data, sede, esecutori, brani_autori
from detail where id= old_id_master
it's a not parametrized version of your solution, but I will try also
the parametrized one.
Thanks a lot
Tonio Tanzi
Navigation:
[Reply to this message]
|