本帖最后由 zhushijie123 于 2011-10-14 16:37:46 编辑

解决方案 »

  1.   

    找到了,请问下,像这样public static string substrFnc(string stringPtr, int lengthPtr)
    只有一个返回值,<%=cFormat.substrFnc(this._Db_Array[k, 1]和this._Db_Array[k,2],this.Letter_Nums) %>  这里的this._Db_Array[k, 1]和this._Db_Array[k,2] 怎么写才能输出这二维数组中的1列和2列呢?
      

  2.   

    就是我的substrFnc函数只有一个参数,怎么输出2个值
      

  3.   

    public string cc(out string aa) 
            {
                aa = "aa";
                return "";
            }        public void sss() 
            {
                string outStr = "";
                string returnstr= cc(out outStr);
            }
      

  4.   

    要得到数据库里的时间不是从这里入手的,cFormat.substrFnc这个函数的作用是用来截取字符串长度的,跟那个什么输出2个参数没关系
    <a href="NewCont.aspx?xk=<%=this._Db_Array[k, 0] %>" target="_blank"><%=cFormat.substrFnc(this._Db_Array[k, 1],this.Letter_Nums) %></a><span><%=this._Db_Array[k, 2] %></span>
    New_List.ascx.cs
      它的代码是:
    public partial class New_List_Cs : System.Web.UI.UserControl
    {
        protected string _Id_Class;    protected int _sRowCount;    protected string _Width_Tab;    protected int _Letter_Nums;    protected string _Link_Css;
        protected string _sTable;
        protected string _sField;
        protected string _sWhere;
        protected string _sOrder;
        protected string _sTime;    protected string[,] _Db_Array;    //*********************************************************    public New_List_Cs()
        {
            this._Id_Class = "";        this._sRowCount = 10;        this._Width_Tab = "100%";        this._Link_Css = "";        this._Letter_Nums = 8;        this._sTable = "tNew";
            this._sField = "zId,zTitle,zTime";
            this._sWhere = "zDelete<0 and zElite>0";  
            this._sOrder = "zOrder desc,zId desc";        this._Db_Array = new string[1, 1] { { "" } };
        }    //*********************************************************    public string Id_Class { set { this._Id_Class = value; } get { return this._Id_Class; } }    //*********************************************************    public string Width_Tab { set { this._Width_Tab = value; } get { return this._Width_Tab; } }    public int sRowCount { set { this._sRowCount = value; } get { return this._sRowCount; } }    public int Letter_Nums { set { this._Letter_Nums = value; } get { return this._Letter_Nums; } }    public string Link_Css { set { this._Link_Css = value; } get { return this._Link_Css; } }    //*********************************************************    public string sTable { set { this._sTable = value; } get { return this._sTable; } }    public string sField { set { this._sField = value; } get { return this._sField; } }    public string sWhere { set { this._sWhere = value; } get { return this._sWhere; } }    public string sOrder { set { this._sOrder = value; } get { return this._sOrder; } }
        
        public string sTime  { set { this._sTime = value; } get { return this._sTime; } }
        //*********************************************************    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.db_List_Bind();
            }
        }    //*********************************************************    protected void db_List_Bind()
        {
            string strv = "";        if(this.Id_Class.Length > 0 && this.Id_Class !="0")
            {
                WorkClass wcs = new WorkClass();            string[,] chs = wcs.ChildClass(this.Id_Class);            for (int k = 0; k < chs.GetLength(0); k++)
                {
                    strv += "," + chs[k, 0];
                }
            }
            strv = (strv.Length > 0 ? " and zType in(" + strv.Substring(1) + ")" : "");        this._sWhere = (this._sWhere.Length > 0 ? " and " + this._sWhere : "");        string strc = strv + this.sWhere;        strc = (strc.Length > 0 ? " where " + strc.Substring(4) : "");        this.sOrder = (this.sOrder.Length > 0 ? " order by " + this.sOrder : "");        cData dt = new cData();        string sql = "select top " + this.sRowCount.ToString() + " " + this.sField + "  from " + this.sTable + strc + this.sOrder;
            
            string[,] dbstr = dt.cArray(sql);        if (dbstr.Length == 1 && dbstr[0, 0].Length == 0)
            {
                this.sRowCount = 0;
            }
            else
            {
                int k = dbstr.GetLength(0);            int g = dbstr.GetLength(1);            this.sRowCount = k;            this._Db_Array = new string[k,g];            for (int i = 0; i < k; i++)
                {
                    this._Db_Array[i, 0] = dbstr[i, 0];
            this._Db_Array[i, 1] = dbstr[i, 1];
            this._Db_Array[i,2]=dbstr[i,2];          }
            }
        }
    }
      

  5.   

    只显示年月日这样.ToString("yyyy-MM-dd")把 for (int i = 0; i < k; i++)
                {
                    this._Db_Array[i, 0] = dbstr[i, 0];
            this._Db_Array[i, 1] = dbstr[i, 1];
            this._Db_Array[i,2]=dbstr[i,2];          }
    红色那一句改成这样
    this._Db_Array[i,2]=Convert.ToDateTime(dbstr[i,2]).ToString("yyyy-MM-dd");
      

  6.   

    非常感谢beyond_me21,也感谢chaichangaini