找不到类型或命名空间名称“List”(是否缺少 using 指令或程序集引用?)

shiyan0634 2008-07-22 05:59:10
#region ICallbackEventHandler Members
string ICallbackEventHandler.GetCallbackResult()
{
//If no text then return nothing
if (_clientArgument.Trim() == String.Empty)
return "[]";
//Otherwise.get the matching rows
SqlDataSource src = new SqlDataSource(_connectionString, _selectCommand);
src.SelectParameters.Add(_dataKeyName, _clientArgument);
DataView dvw;
try
{
dvw = (DataView)src.Select(DataSourceSelectArguments.Empty);
}
catch
{
return "[]";
}

//Return matching rows in a JavaScript array
List<String> rows = new List<String>();
foreach (DataRowView row in dvw)
rows.add(String.Format("'{0}'", row[0].ToString().Replace("'", @"\'")));

return "[" + String.Join(",", rows.ToArray()) + "]";
}

void ICallbackEventHandler.RaiseCallbackEvent(string clientArgument)
{
_clientArgument = clientArgument;
}
#endregion
上面这段代码,List<String> rows = new List<String>();这一句有错误。
错误为“找不到类型或命名空间名称“List”(是否缺少 using 指令或程序集引用?)”
请问怎么解决!
谢谢!!
...全文
9628 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
feiyuan0204 2008-11-30
  • 打赏
  • 举报
回复
后台当然可以
但对于前台那该怎么办?
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div class="content">
<div class="tptitle" style="left: -357px; position: relative; top: 0px" >
<div class="xbt"></div>
<div class="tp">
<% Advice ad = new Advice();
List<Advice> ads = ad.getAdvices();
%>
<script type="text/javascript">
<%
for(int i=0;i<ads.size();i++){
Advice adn=ads.get(i);
%>
imgUrl<%=i%>="<%=adn.URL%>"
imgtext<%=i%>="<%=adn.Picture%>"
imgLink<%=i%>=escape("<%=adn.Link%>")
<%
}
%>
viena 2008-07-23
  • 打赏
  • 举报
回复
我是说CSDN的回帖引用废,你骂我做啥?

我觉得1楼说的对你最有用!为啥不给分?
等别人嚼碎了喂到嘴里再吃有味道吗?
viena 2008-07-23
  • 打赏
  • 举报
回复
马后炮的又不是我一个?为啥单说我呢?
我这样的人咋了?
neuguodong 2008-07-22
  • 打赏
  • 举报
回复
命名空间:
using System.Collections.Generic;
shiyan0634 2008-07-22
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 viena 的回复:]
废,引用回复失效~
[/Quote]
什么叫“马后炮”??
就是你这样的人!!
你才“废”!!!!!!!!!!
viena 2008-07-22
  • 打赏
  • 举报
回复
废,引用回复失效~
viena 2008-07-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 amandag 的回复:]
using System.Collections.Generic;

[/Quote]
hecong875 2008-07-22
  • 打赏
  • 举报
回复
using System.Collections.Generic;
amandag 2008-07-22
  • 打赏
  • 举报
回复
using System.Collections.Generic;
dragonsoft_2005 2008-07-22
  • 打赏
  • 举报
回复
缺少引用,查找一下命名空间,引入或者使用全名!

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧