DataView returns 0 rows

  • Thread starter Thread starter Andy Sutorius via DotNetMonster.com
  • Start date Start date
A

Andy Sutorius via DotNetMonster.com

Hi,

My dataview is returning 0 rows however I know there are rows in the
dataset with the matching data. Do you see anything wrong with my code. Can
you suggest a way to debug?

Thanks,

Andy

public DataView BindCodeDropDown()
{
SqlConnection oConn = new SqlConnection(DBConnectionString);
SqlDataAdapter dadCode = new SqlDataAdapter("sp_web_835_ddl_code",oConn);
DataSet dstCode = new DataSet();
dadCode.Fill(dstCode,"CodeTable");
// return dstCode;

DataView CodeView = new DataView(dstCode.Tables["CodeTables"]);
CodeView.RowFilter="type='F'";
return CodeView;
}
 
Andy,
The name of your table when you create the dataview is "CodeTables" ...plural.
The name of the table filled is "CodeTable"...singular.

Check to be sure the names are the same.

Hope this helps,
Dave
 
Andy - DaveVB answered your question.. it's the spelling. HOwever absent a
good reason to use Untyped DataSets, using Typed Datasets do provide you
not only performance benefits, but you can have the compiler help you out ot
make sure that typos and the like don't occur. I've made this same mistake
with datatable names and colum names so many times that using untyped
datasets now gives me the same icky feeling of not wearing a setbelt.


--
W.G. Ryan MVP Windows - Embedded

Have an opinion on the effectiveness of Microsoft Embedded newsgroups?
Let Microsoft know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Bill,
using Typed Datasets do provide you not only performance benefits,

Not arguing about the rest of your message. However can you tell me about
this why.

In fact a typed dataset cost more time. (What is just an accepted thing from
OOP and than we are talking about pieces of nanoseconds).

However, a performance benefit I can absolute not see. It's just and
inherited untyped dataset.

So enlighten me in this, why you write this forever?

Cor
 
Back
Top