数据库有这么一个表
id IsNull
1     0
2     0
3     0
4     0
5     0
6     1
如果IsNull有1,程序里就..... 如果没有1就........
请问这要什么实现? 

解决方案 »

  1.   

    int? i;
    if(DataKey==1)
    i=1
      

  2.   


    SqlConnection sc = new SqlConnection("连接字符串");
    SqlDataAdapter sda = new SqlDataAdapter("select * from 表名 where IsNull=1", sc);
    sc.Open();
    DataSet ds = new DataSet();
    sda.Fill(ds);
    if(ds.Tables[0].Rows.Count>0)//IsNull有1
    {
        //do something
    }
    else//没有1
    {
        //do something
    }
    sc.Close();
      

  3.   

    if(IsNull==1)
    {
      //程序里就..... 
    }
    else
    {
      //没有1就........ 
    }
    按楼主的说法来看,我觉得我是标准答案
      

  4.   

    string str = "连接字符串";
            string strSql="select IsNull from 你的表名";
            using (SqlConnection con = new SqlConnection(str))
            {
                con.Open();
                SqlCommand com = new SqlCommand(strSql, con);
                SqlDataReader reader = com.ExecuteReader();
                while (reader.Read())
                {
                    int i = reader.GetInt32(0);
                    if (i == 0)
                    {
                        //你的程序处理
                    }
                    else {
                        //你的程序处理
                    }
                }
                reader.Close();
      

  5.   

    SqlCommand sqlcmd = new SqlCommand("SELECT [IsNull] FROM 表名", sqlcnn);
    SqlDataAdapter adapter = new SqlDataAdapter(sqlcmd);
    DataTable table = new DataTable();
    adapter.Fill(table);foreach(DataRow row in table.Rows)
    {
        if(Convert.ToInt32(row[0]) == 0)
            //code for IsNull == 0
        else
            //code for IsNull == else
    }
      

  6.   

    select iid,isnull( [isnull] ,'ribenren');
    或者
    select id ,case when  [isnull]=  null then 'chao' else when  [isnull]= 1 then 'rinijiejie' else '干他几几' end ;   
      

  7.   

    swicth(param)
    {
    case "0":fuc(0);break;
    case "1":fuc(1);break;
    defult:fuc();break;
    }
      

  8.   

    select from 表 where isnull>0当记录数==0
    .....
    else
    .....