在asp.net csharp中转换asp代码 [英] Converting asp code in asp.net csharp
问题描述
我有一个ASP应用程序.现在我要在ASP.NET C Sharp中对其进行转换.
在ASP中,我们已将ms访问权限用作数据库.现在我正在使用mysql.
我没有更改网站的设计,并且我的结果是动态的.我正在使用table放置它,并且我没有使用任何asp.net控件.
现在我必须在csharp中转换数据库代码.
我已成功建立连接.我正在使用Dataset ds
我的asp代码如下,
Hi,
I have one asp application.I am Converting it now in asp.net c sharp.
In asp we have use ms access as database.and now i am using mysql.
I havent change design of website and my results are dynamic.I am displating it in using table.and i am not using any asp.net control.
now i have to convert database code in csharp.
I have made connection successfully.I am using Dataset ds
My asp code is following,
if rs.EOF =true then
Response.Redirect("error4.htm")
else
dim intPageSize,PageIndex,TotalPages
dim RecordCount,RecordNumber,Count
intpageSize=11
PageIndex=request("PageIndex")
if PageIndex="" then PageIndex=1
RecordCount=rs.RecordCount
RecordNumber=(intPageSize * PageIndex) - intPageSize
rs.PageSize =intPageSize
rs.AbsolutePage = PageIndex
TotalPages=rs.PageCount
dim intPrev,intNext
intPrev=PageIndex - 1
intNext=PageIndex +1
Count=1
我如何将其转换为csharp.
什么等效于ado.net中的Recordset.EOF,Recordset.PageSize,Recordset.AbsolutePage,Recordset.PageCount
请帮帮我.
在此先感谢.
how i can convert it into csharp.
what is equivalent to Recordset.EOF,Recordset.PageSize,Recordset.AbsolutePage,Recordset.PageCount in ado.net
please help me.
Thanks in advance.
推荐答案
RecordSet不在Asp.Net中.替代方法是SqlDataReader.
和rs.Eof等价物,您可以使用
RecordSet is not in Asp.Net. Alternative to this is SqlDataReader.
and rs.Eof equivalent you can use
SqlDataReader reader = command.ExecuteReader();
reader.Read()
请查看此链接以获取更多信息: http://msdn.microsoft.com /en-us/library/system.data.sqlclient.sqldatareader.read.aspx
另一个选择是您还可以dataSet
而不是rs.Eof,您可以找到记录数
例子
Look at this link for More : http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.read.aspx
Another Alternative is you can you dataSet also
and in that instead of rs.Eof you can find count of records
example
dataset.Table[0].rows.Count > 0
这篇关于在asp.net csharp中转换asp代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!