p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 (http://p2p.wrox.com/forumdisplay.php?f=226)
-   -   Error code: Chapter 17 Pag 576 (http://p2p.wrox.com/showthread.php?t=58468)

luisxvarg May 28th, 2007 03:44 PM

Error code: Chapter 17 Pag 576
 
if you test datagridview Project and try to update datarow throw exception

You read this code:

<asp:SqlDataSource ID=”sdsAuthors” Runat=”server”
ProviderName = "System.Data.SqlClient"
ConnectionString = "Server=bnewsome; User ID=sa;
Password=!p@ssw0rd!;Database=pubs; "
SelectCommand = "SELECT au_id, au_lname, au_fname, phone,
address, city, state, zip FROM authors"
UpdateCommand = "UPDATE authors SET au_lname = @au_lname,
au_fname = @au_fname, phone = @phone, address = @address,
city = @city, state = @state, zip = @zip
WHERE au_id = @original_au_id" >

 <UpdateParameters>
         <asp:Parameter Type="String" Name="au_lname"></asp:Parameter>
         <asp:Parameter Type="String" Name="au_fname"></asp:Parameter>
         <asp:Parameter Type="String" Name="phone"></asp:Parameter>
         <asp:Parameter Type="String" Name="address"></asp:Parameter>
         <asp:Parameter Type="String" Name="city"></asp:Parameter>
         <asp:Parameter Type="String" Name="state"></asp:Parameter>
         <asp:Parameter Type="String" Name="zip"></asp:Parameter>
         <asp:Parameter Type="String" Name="au_id"></asp:Parameter>
      </UpdateParameters>

and no works, so to fix it change the line

WHERE au_id = @original_au_id" >

with the line

WHERE au_id = @au_id" >

and now it works






Civil Engineer, VB developer

mk goody October 15th, 2007 08:06 PM

[V] DON'T DO THAT. If you do what you suggested, all the values in the DB will be modified. Your problem is not solved yet.

Can anyone else make a suggestion??



All times are GMT -4. The time now is 09:33 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.