Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 by Thearon Willis, Bryan Newsome; ISBN: 9780764574016
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 18th, 2009, 11:47 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Gridview Chapter 17 error

Hi all,

Hopefully someone can help. Just started Visual Basic - using Visual Studio 2005 pro
and connecting to a sql database on a seperate server

Entered the code from the Try it Out on Page 575 with some amendments as follows to connect to the sql database.

<%@PageLanguage="VB"AutoEventWireup="false"CodeFile="Default.aspx.vb"Inherits="_Default" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
htmlxmlns="http://www.w3.org/1999/xhtml">
<
headrunat="server">
<title>Grid View</title>
</head>
<
body>
<formid="form1"runat="server">
<div>
<asp:sqlDataSourceID="tblAnimalTypes"runat="server"providername="System.Data.SqlClient"
connectionstring="Server=*********; User ID=AME;
password=********* ;database=AME;"
SelectCommand="SELECT txtAnimal, txtColour FROM tblAnimalTypes"
UpdateCommand="UPDATE tblAnimaltypes SET txtColour = @txtColour where txtAnimal = @original_txtAnimal">
<UpdateParameters>
<asp:ParameterType="String"Name="txtAnimal"/><asp:Parameter/>
<asp:ParameterType="String"Name="txtColour"/><asp:Parameter/>
</UpdateParameters>
</asp:sqlDataSource>
<asp:DataGridID="gdvAnimals"Runat="Server"DataSourceID="tblAnimalTypes"
allowpaging="true"AllowSorting="true"AutoGenerateColumns="true"DataKeyField="txtAnimal">
<PagerStyleBackColor="Gray"ForeColor="White"HorizontalAlign="Center"/>
<Headerstylebackcolor="black"ForeColor="white"/>
<AlternatingItemStyleBackColor="LightGray"/>
<Columns>
<
asp:CommandFieldbuttontype="Button"showeditbutton="true"/>
</Columns></asp:DataGrid></div>
</form>
</
body>
</
html>

Without the <asp:CommandField line the data grid is shown with data from the database but with any editing facilities

With the <asp:CommandField line the following error is given

Error 1 System.Web.UI.WebControls.DataGridColumnCollection must have items of type 'System.Web.UI.WebControls.DataGridColumn'. 'asp:CommandField' is of type 'System.Web.UI.WebControls.CommandField'. C:\WebSite\DataGridView\Default.aspx 31

The default.aspx.vb has the following

PartialClass _Default
Inherits System.Web.UI.Page
EndClass

Any help would be appreciated
  #2 (permalink)  
Old February 19th, 2009, 11:49 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview Chapter 17 error

Found my problem

<asp:DataGrid should have read <asp:GridView
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error code: Chapter 17 Pag 576 luisxvarg BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 15th, 2007 08:06 PM
Chapter 17 First Try It Out paloyme BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 7 August 23rd, 2006 11:14 AM
Chapter 17 first Try It Out paloyme Visual Basic 2005 Basics 0 April 17th, 2006 04:34 AM
Chapter 17 Gaby BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 3 September 8th, 2005 11:50 AM



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


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