c#读取oracle数据,使用MVC(ASP.net/ C#)从Oracle数据库获取数据

I am developing a website in Visual Studio 2013 (MVC) and I am trying to show the data in my Oracle Database in a GridView. I used the DataSet model and was able to get the data. However, it is very very slow. It takes minutes to load the page and it freezes (closes the Visual Studio) most of the time in the middle of the process.

Having this issue, I created a database model and wrote queries in C#. I passed the list of items returned using the controllers and then printed the data on a View like this:

@model List>

LocationServer NamePolicyStart DateReport DateStatusStateScheduleTypeDest. Media Serverjob ID

@foreach (var s in Model)

{

@foreach (var i in @s)

{

@i

}

}

It works well in most cases where the returning list is small. The problem starts when the list is long. The page loads quickly but it freezes for a while (I assume that is because the for-loop is still running through the list when the page is loaded, creating new table rows)

My question is if there is a way to split the list into multiple pages using the method I used. And if not, is there anyway to use a webform to show the data in a list> ?

*I tried all kinds of tools visual studio offers but all of them are very slow.

Solutions1

This nuget package, Paged List Mvc, works great for me and is very flexible. You only have to add a parameter, (the page you want) to your call to the controller and it does the rest.

The only thing I have found it does not do easily is localizing the "First", "Next", "Previous" in text without hard coding the equivalents in whatever language you choose.

You can display the list as numbers to get around this.

Talk1:

Why would you want to localize the page numbers /within/ the grid? I don't believe I've ever seen that in an application.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值