求助 本帖最后由 zhushijie123 于 2011-10-14 16:37:46 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 找到了,请问下,像这样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列呢? 就是我的substrFnc函数只有一个参数,怎么输出2个值 public string cc(out string aa) { aa = "aa"; return ""; } public void sss() { string outStr = ""; string returnstr= cc(out outStr); } 要得到数据库里的时间不是从这里入手的,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]; } } }} 只显示年月日这样.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"); 非常感谢beyond_me21,也感谢chaichangaini asp.net 打开新窗体 导入excel文件内容到页面 请问如何实现网上收费,像公务员考试缴费一样? 为什么jquery代码在本地服务器和真实服务器运行结果不一样 问大家一个简单的问题,关于在数据库中查找数据的! DropDownList树类显示怎么实现 flash调用WebService的问题,那位大侠帮帮忙啊,郁闷几天了 如何记录一个按钮的点击次数 帮我看看这个图片按钮哪里用错了?我用作删除按钮 用了treeview 控件,在充填数据时碰到了问题,好像还要些算法。。。 怎么提取关键词搜索相关内容? 还是sql注入的问题
只有一个返回值,<%=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列呢?
{
aa = "aa";
return "";
} public void sss()
{
string outStr = "";
string returnstr= cc(out outStr);
}
<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]; }
}
}
}
{
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");