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
|