Wrox Programmer Forums
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 20th, 2009, 05:21 AM
Authorized User
Join Date: Jul 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Casting a data Row

hello everyone i've written the code below from vb to C#. but it gives me an error saying it cannot explicitly convert "System.Data.DataRow" to "Busl.tblDocument" ( busl is my dataset and tblDocument is my Table.) An explicit conversion exist(are you missing a cast). It underlines the ds variable where r=ds.tblDocument.Rows.Find(Usr.id);

publicstring Update(Docs Usr)
busl.tblDocumentRow r;
Dbconnection cd = newDbconnection();
SqlDataAdapter adp = newSqlDataAdapter("Select * From Account", cd.con);
SqlCommandBuilder cmb = newSqlCommandBuilder(adp);
String msg;
r = ds.tblDocument.Rows.Find(Usr.id);
r.Description = Usr.description;
r.Fpath = Usr.filepath;
r.Createdby = Usr.usrC;
r.Datec = Usr.dc;
//for all fields
msg =
return msg;

thanks in advance
Old April 20th, 2009, 07:57 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

Hello, you need the cast (VB background??)

r = (busl.tblDocumentRow) ds.tblDocument.Rows.Find(Usr.id);


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
================================================== =========
I know that CVS was evil, and now i got the
================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Binding - Editing GridView Row Data desk_star BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 7 December 30th, 2007 11:07 AM
Row data in listbox? DrConners Access VBA 1 June 8th, 2007 02:20 PM
casting textbox to sqlserver number data type yoord BOOK: Beginning ASP.NET 1.0 1 October 17th, 2004 06:09 AM
Manage data row by row in datagrid Dragonist Classic ASP Databases 5 July 29th, 2004 04:17 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.