Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 21st, 2009, 02:49 AM
Authorized User
 
Join Date: Jul 2008
Location: Cape Town, Western Cape, South Africa.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reply: Datarow cast

Hello

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);
adp.Fill(ds.tblDocument);
foreach (busl.tblDocumentRow r in ds.tblDocument.Rows)
{
usr.id = r.id;
usr.description=r.Description;
usr.filepath=r.Fpath;
usr.dc=r.Datec;
usr.usrC=r.Createdby;
usr.fieds.Add(r.id);
usr.fieds.Add(r.Description);
usr.fieds.Add(r.Fpath);
usr.fieds.Add(r.Datec);
usr.fieds.Add(r.Createdby);
col.Add(usr);
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.Description=dc.description;
r.Fpath=dc.filepath;
r.Datec = dc.dc;
r.Createdby=dc.usrC;
ds.tblDocument.Rows.Add(r);
//for all fields
adp.Update(ds.tblDocument);
ds.AcceptChanges();
msg =
"Success";
return msg;
}
__________________
supertedz
  #2 (permalink)  
Old April 21st, 2009, 07:43 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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.

Thanks.

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???
__________________
HTH

Gonzalo


================================================== =========
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 :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 


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
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



All times are GMT -4. The time now is 08:51 AM.


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