You are here: Re: SQL Server error '80040e31': please help me! « MsSQL Server « IT news, forums, messages
Re: SQL Server error '80040e31': please help me!

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация