for (i = 0; i != sarray.Length(); i++)
        {
          if (SMS.Checked == true && recu2["psnMobilePhone"].ToString().Trim().Length > 0)
           {
            com_sms.CommandText = "insert into AQ_SMS(SmsID,psnMobilePhone,SmsContent,SmsSort) values(@SmsID,@psnMobilePhone,@SmsContent,@SmsSort)";
            com_sms.Parameters.Clear();
            com_sms.Parameters.AddWithValue("@SmsID", LiuShuiNO);
            com_sms.Parameters.AddWithValue("@psnMobilePhone", recu2["psnMobilePhone"].ToString().Trim());
            com_sms.Parameters.AddWithValue("@SmsContent", smsContent);
            com_sms.Parameters.AddWithValue("@SmsSort");
           }
        }CS0149: 应输入方法名称
是我这个代码有问题嘛?怎么改?

解决方案 »

  1.   

    SMS.Checked 你这里是方法还是属性?如果是方法 改为SMS.Checked()
      

  2.   

      protected void ImageButton4_Click(object sender, ImageClickEventArgs e)
        {
            string LiuShuiNO = "";
            string SmsContent = TextBox2.Text;
            string strMobile = TextBox1.Text;//手机号码 
            Safety safety = new Safety();
            int i;
            char[] p = { ',' };
            string[] sarray = strMobile.Split(p);
            string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["AqConn"].ToString();
            SqlConnection con = new SqlConnection(connectionString);
            con.Open();
            SqlCommand com = new SqlCommand();        SqlCommand cmd = new SqlCommand("Pr_GetNewLiuShuiNO", con);
            cmd.CommandType = CommandType.StoredProcedure;//指示Pr_GetNewLiuShuiNO为存储过程 
            SqlParameter my = new SqlParameter("@NewNO", SqlDbType.VarChar, 200);
            my.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(my);
            cmd.ExecuteNonQuery();//执行存储过程 
            com.Dispose();
            LiuShuiNO = my.Value.ToString();
            for (i = 0; i != sarray.Length(); i++)
            {
                safety.Pr_sdfs(SmsID, psnMobilePhone, SmsContent, SmsSort);
                if (SMS.Checked == true && recu2["psnMobilePhone"].ToString().Trim().Length > 0)
               {
                com_sms.CommandText = "insert into AQ_SMS(SmsID,psnMobilePhone,SmsContent,SmsSort) values(@SmsID,@psnMobilePhone,@SmsContent,@SmsSort)";
                com_sms.Parameters.Clear();
                com_sms.Parameters.AddWithValue("@SmsID", LiuShuiNO);
                com_sms.Parameters.AddWithValue("@psnMobilePhone", recu2["psnMobilePhone"].ToString().Trim());
                com_sms.Parameters.AddWithValue("@SmsContent", smsContent);
                com_sms.Parameters.AddWithValue("@SmsSort");
               }
            }
        }
    我的代码总共不到100行啊?到底什么原因帮帮我啊!!!
      

  3.   

    行 75:         for (i = 0; i != sarray.Length(); i++)
    这一行红色的!!
      

  4.   

     for (int i = 0; i != sarray.Length(); i++) 
      

  5.   

    同意 sarray.Length
    数组有Length属性不是方法
     ArrayList有Length方法