/// <summary>
    /// 读公司的名字
    /// </summary>
    private string readcom()
    {        SqlConnection con = new SqlConnection("uid=sa;server=.;pwd=337024;database=zhuoyue");
        SqlDataAdapter cmd = new SqlDataAdapter("select * from zuoyue_companey",con);
        DataSet dst = new DataSet();
        cmd.Fill(dst);
        string rstr = "";
        for (int i = 0; i < dst.Tables[0].Rows.Count; i++)
        {            rstr += "mm_menu_0704102145_0.addMenuItem('" + dst.Tables[0].Rows[i]["companey_name"] + "',\"window.open('../other/main.aspx?id=" + dst.Tables[0].Rows[i]["companey_id"] + "', '_blank');\");";
            
        }
        return rstr;    }

解决方案 »

  1.   

    rstr += "mm_menu_0704102145_0.addMenuItem('" + dst.Tables[0].Rows[i]["companey_name"] + "',\";window.open('../other/main.aspx?id=" + dst.Tables[0].Rows[i]["companey_id"] + "', '_blank');\");";
      

  2.   

    报什么错误?从DataTable里取出的值最好转化成字符串
     rstr += "mm_menu_0704102145_0.addMenuItem('" + dst.Tables[0].Rows[i]["companey_name"].ToString() + "',\"window.open('../other/main.aspx?id=" + dst.Tables[0].Rows[i]["companey_id"].ToString() + "', '_blank');\");";
      

  3.   

    测试过了 没问题
                rstr += "mm_menu_0704102145_0.addMenuItem('" + dst.Tables[0].Rows[i]["companey_name"] + "',\"window.open('../other/main.aspx?id=" + dst.Tables[0].Rows[i]["companey_id"] + "', '_blank');\");";