错误如下:
编译器错误信息:
CS0246: The type or namespace name 'DataRow' could not be found (are you missing a using directive or an assembly reference?)源错误: 行 39: for( m=0;m<no2;m++)
行 40: {
行 41: DataRow dr1=rs.Tables["recontent"].Rows[m];
行 42: %>
行 43:
---------------------------------------------------------------------------
html代码如下:
<TABLE id="Table4" style="WIDTH: 728px; HEIGHT: 66px" cellSpacing="1" cellPadding="1" width="728"
border="0">
<%
int no2=rs.Tables["recontent"].Rows.Count;
int m;
if(no2>0)
{
for( m=0;m<no2;m++)
{
DataRow dr1=rs.Tables["recontent"].Rows[m];
%>
<TR>
<TD width="134" height="20" style="WIDTH: 134px">回复人:<%=rewriter%></TD>
<TD width="647" colspan="2" rowspan="3" vAlign="top">www<%=recontent%></TD>
</TR>
<TR>
<TD height="19" style="WIDTH: 134px">回复时间:<%=retime%></TD>
</TR>
<TR>
<TD style="WIDTH: 134px"></TD>
</TR>
<%
}
}
%>
</TABLE>
-----------------------------------------------
aspx代码如下:
string sql3="select rewriter,recontent,retime from recontent where con_id="+id;
OleDbDataAdapter myadapter2=new OleDbDataAdapter(sql3,myconn);
rs=new DataSet();
myadapter2.Fill(rs,"recontent");
recontent=dr1["recontent"].ToString();
retime=dr1["retime"].ToString();
rewriter=dr1["rewriter"].ToString();-----------------------------------------
我只想实现从数据表中读出n条记录
然后再table中显示出来,请问如何解决
谢谢~~
编译器错误信息:
CS0246: The type or namespace name 'DataRow' could not be found (are you missing a using directive or an assembly reference?)源错误: 行 39: for( m=0;m<no2;m++)
行 40: {
行 41: DataRow dr1=rs.Tables["recontent"].Rows[m];
行 42: %>
行 43:
---------------------------------------------------------------------------
html代码如下:
<TABLE id="Table4" style="WIDTH: 728px; HEIGHT: 66px" cellSpacing="1" cellPadding="1" width="728"
border="0">
<%
int no2=rs.Tables["recontent"].Rows.Count;
int m;
if(no2>0)
{
for( m=0;m<no2;m++)
{
DataRow dr1=rs.Tables["recontent"].Rows[m];
%>
<TR>
<TD width="134" height="20" style="WIDTH: 134px">回复人:<%=rewriter%></TD>
<TD width="647" colspan="2" rowspan="3" vAlign="top">www<%=recontent%></TD>
</TR>
<TR>
<TD height="19" style="WIDTH: 134px">回复时间:<%=retime%></TD>
</TR>
<TR>
<TD style="WIDTH: 134px"></TD>
</TR>
<%
}
}
%>
</TABLE>
-----------------------------------------------
aspx代码如下:
string sql3="select rewriter,recontent,retime from recontent where con_id="+id;
OleDbDataAdapter myadapter2=new OleDbDataAdapter(sql3,myconn);
rs=new DataSet();
myadapter2.Fill(rs,"recontent");
recontent=dr1["recontent"].ToString();
retime=dr1["retime"].ToString();
rewriter=dr1["rewriter"].ToString();-----------------------------------------
我只想实现从数据表中读出n条记录
然后再table中显示出来,请问如何解决
谢谢~~
解决方案 »
- TFS2010误删数据库
- 用c#语言 将两个excel表格导入并进行比较显示出这两个表格中的差异
- Asp.net 如何加多国语言功能?
- 有关正则表达式的应用问题,急,大侠们请进!
- VS2003开发C#的ASP.NET程序,编译是出现:无法在WEB服务器上启动调试,因为没有启用集成WINDOWS身份验证。
- cookie和session问题?谁告诉我呀?
- 新手求指导
- 内容显示为html出错!!
- 在.net C#里怎样调用非托管动态库函数dll?
- 数据更新问题
- 关于用户登陆的问题~~~~~~~~~~那位大哥可以帮我看看可以么?
- ASP.NET 怎么实现像Windows Form 那样的 Hint????
dr1=rs.Tables["recontent"].Rows[m];
楼上的谢谢先,在html代码不行挖~
dr1=rs.Tables["recontent"].Rows[m];
recontent首先判断这个字段存在否。最好的方法,是跟踪一下,看DataTable里有些什么内容。
.net的开发环境(Microsoft Visual Studio .NET 2003)里是最好跟踪的。
且保证引用了。引用System.Data这个名称空间
提示类型或命名空间找不到(是否少了引入指令或程序集引用?)
建议:
1.在页面的page指令下加<%@ Import Namespace="System.Data" %>
2.对所有使用的变量包括对象声明先
smallMage的可以了
考虑对象的作用域没?
myadapter2.Fill(rs,"recontent");
recontent=dr1["recontent"].ToString();
retime=dr1["retime"].ToString();
rewriter=dr1["rewriter"].ToString();
这段中的drl是个对象,你实例化没?要声明一个全局变量就可以了。参考你上次提的问题吧
dr1已经在aspx代码页中
public DataRow dr,dr1;
你的sql语句执行的结果返回一条记录,
for( m=0;m<no2;m++)
{
DataRow dr1=rs.Tables["recontent"].Rows[m];那上面这些又是什么?