我正在讀取表中的所有字符串值並將其添加到數組中,如下所示。如何從表中讀取字符串值並將其附加到單個字符串中
da2.Fill(ds, "DNAiusTwitter_Table");
int counts = ds.Tables[0].Rows.Count;
for (int i = 0; i < counts; i++)
{
names[i, 0] = ds.Tables[0].Rows[i][3].ToString();
}
我怎樣才能獲得字符串append = 'name1','name2','name3','name4';
如何傳遞這些值來參考下面的代碼:
for (int i = 0; i < 1; i++)
{
HtmlGenericControl scriptTagLinks = new HtmlGenericControl("script");
scriptTagLinks.Attributes["type"] = "text/javascript";
string scrip1 = "$(function() {$(\"[src='" + names[i, 0] + "']\"" + ").pinit();});";
var scrip = "var tweetUsers=['" +append + "'," + "'" + splitted[3]+"']";
scriptTagLinks.InnerHtml = scrip;
this.Controls.Add(scriptTagLinks);
}
只需將它們作爲託管代碼的方法的參數傳遞即可。 – Guillaume