开发者

Check for empty db column value and return results - c# asp.net

I got a great response the last time I posted here.

I have the following table structure in my database for a small Gallery page on my site.

id | title | img1 | img1sml | img2 | img2sml | img3 | img3sml

Now, id and title are manda开发者_如何学Ctory, however the rest are not.

I'd like to loop through all my sml columns that have values in them and create <img src="--column value here--" /> for each of them.

I'd also like to do the same with my img columns - loop through any non-empty columns and list them

Can someone show me how I can do this?

Many thanks for any help with this


You can check NULL as follows

if(!YourObject.Equals(System.DBNull.Value))


You can do it get Not Null Rows and then iterate those rows.

DataRow[] dr = dtbl.Select("img1 is Not Null");
 foreach (DataRow dr in dataRows)
 {

 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜