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 21st, 2009, 02:49 AM
Authorized User
Join Date: Jul 2008
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reply: Datarow cast


Thanks once more sir for your help: I did solve the error within the retrieve statement because i declared 'r' twice in the same scope its ok now, but the retrieve is underlined displaying this message
"Docs.Retrieve(string): 'Not all code paths returns a value" maybe because of arraylist and Collection is not available in c#, i only see collection base. The last thing, i did put parentheses in front of 'r=ds.tblDocument.NewRow()' but ds still get underlined displaying the same error that i just mentioned in the previous e-mail. Looking forward to your positive respond.

First Error Within the retrieve fucntion

publicArrayList(Can i have Collection type here) Retrieve(string strCriteria ) retrieve is underlined displaying "Docs.Retrieve(string): 'Not all code paths returns a value"
ArrayList col = newArrayList();
Docs usr = newDocs();
// busl.tblDocumentRow r;
//NullableDataReader r = New NullableDataReader();
Dbconnection cd = newDbconnection();

SqlDataAdapter adp = newSqlDataAdapter("Select * From Account Where " + strCriteria, cd.con);
SqlCommandBuilder cmb = newSqlCommandBuilder(adp);
foreach (busl.tblDocumentRow r in ds.tblDocument.Rows)
usr.id = r.id;
return col;

Second problem within the Create function

publicstring create(Docs dc)
busl.tblDocumentRow r;
Dbconnection cd = newDbconnection();
SqlDataAdapter adp = newSqlDataAdapter("Select * From Account", cd.con);
SqlCommandBuilder cmb = newSqlCommandBuilder(adp);
string msg;
r = ds.tblDocument.NewRow; ds is underllined displaying "Cannot convert group method NewRow to non-delegate type busl.tblDocument.Row" did you intend to invoke the method?
r.id = dc.id;
r.Datec = dc.dc;
//for all fields
msg =
return msg;
Old April 21st, 2009, 07:43 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

Please, can you follow up your threads and not start a new one every time you have a question?? That way, any user that found it, can also have the full follow up.


And for you errors, did you try google??? your errors are very basic (not all code path have a return, if you follow your code you will see that a part of it doesn't return anything, see what happen when tblDocument has no records. ). did you try compiling after you put the () after the newrow method?? (because it a method.).

Also, maybe you need to cast newrow return to something else???


================================================== =========
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
Thanks to datarow cast reply teddyk ASP.NET 2.0 Professional 1 April 20th, 2009 09:58 AM
DataRow.ItemArray abhi123 C# 4 June 7th, 2007 02:33 PM
Need help understanding DataRow asp_convert ADO.NET 3 March 13th, 2007 02:39 PM
Specified cast is not valid in DataRow Casting yoord BOOK: Beginning ASP.NET 1.0 23 September 21st, 2004 06:34 AM
deleting a datarow sand133 VB Databases Basics 0 July 14th, 2004 07:08 AM

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