主要是想在tables中查出不为空的那一行(因为在表中就只有一条记录不是空的),还要知道不为空的那一行是第几行,,应该怎么写代码?
SqlConnection conn=new SqlConnection();
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter(strcmd,conn);
da.Fill(ds,"info");
ds.Tables["info"].Select(“select * from pic where dt!=null”);
6 个解决方案
#1
select * from pic where dt is not null
#2
谢谢,楼上的朋友,我怎么样知道不为null的那条数据在ds.Tables["info"]中是第几行呢?
#3
for(int i=0;i<ds.tables["info"].rows.count;i++)
{
if (ds.tables["info"][i][?]==null)
{
//write i is null
}
}
{
if (ds.tables["info"][i][?]==null)
{
//write i is null
}
}
#4
我怎么样知道不为null的那条数据在ds.Tables["info"]中是第几行呢?
//遍历每一行
//或者在绑定的时候,对应写一个函数做相应处理(类似于一般的字符处理)
//遍历每一行
//或者在绑定的时候,对应写一个函数做相应处理(类似于一般的字符处理)
#5
select * from pic where dt!=null”
改为 select * from pic where dt is not null
改为 select * from pic where dt is not null
#6
如果为null,赋0:
select isnull(你的字段,0) from table
select isnull(你的字段,0) from table
#1
select * from pic where dt is not null
#2
谢谢,楼上的朋友,我怎么样知道不为null的那条数据在ds.Tables["info"]中是第几行呢?
#3
for(int i=0;i<ds.tables["info"].rows.count;i++)
{
if (ds.tables["info"][i][?]==null)
{
//write i is null
}
}
{
if (ds.tables["info"][i][?]==null)
{
//write i is null
}
}
#4
我怎么样知道不为null的那条数据在ds.Tables["info"]中是第几行呢?
//遍历每一行
//或者在绑定的时候,对应写一个函数做相应处理(类似于一般的字符处理)
//遍历每一行
//或者在绑定的时候,对应写一个函数做相应处理(类似于一般的字符处理)
#5
select * from pic where dt!=null”
改为 select * from pic where dt is not null
改为 select * from pic where dt is not null
#6
如果为null,赋0:
select isnull(你的字段,0) from table
select isnull(你的字段,0) from table