使用Visual Studio 2010 Server Management Studio中2008年我做了一个功能,通过它教师可以看到所有年份的所有学生的成绩:导出网格视图的数据导入Excel
通过下拉菜单选择它显示的数据网格视图,并有一个按钮供教师在Excel工作表中查看选择。对于一些选择有很多数据,所以需要时间。
现在我的客户端不希望在页面中显示网格视图,而是根据下拉选择直接导出到Excel中。
任何人都可以帮助我做到这一点,它会让我的网页加载速度更快一点吗?
使用Visual Studio 2010 Server Management Studio中2008年我做了一个功能,通过它教师可以看到所有年份的所有学生的成绩:导出网格视图的数据导入Excel
通过下拉菜单选择它显示的数据网格视图,并有一个按钮供教师在Excel工作表中查看选择。对于一些选择有很多数据,所以需要时间。
现在我的客户端不希望在页面中显示网格视图,而是根据下拉选择直接导出到Excel中。
任何人都可以帮助我做到这一点,它会让我的网页加载速度更快一点吗?
首先在ssms中写入存储过程以检索数据。 应该是这样
CREATE PROCEDURE [Retrieveresult] (@selectedfield nvarchar(50))
AS
BEGIN
select * from students where [email protected]
END
然后在VisualStudio中
oConn = new SqlConnection();
oConn.ConnectionString = "your connection string"
SqlCommand command = new SqlCommand("Retrieveresult");
command.CommandType = System.Data.CommandType.StoredProcedure;
oConn.Open();
command.Parameters.Add(new SqlParameter("@selectfield", System.Data.SqlDbType.nvarchar(50)));
command.Parameters["@selectfield"].Value="selected value from gridview"
IDataReader oDr;
oDr=command.executereader();
while(oDr.read())
{
Get the corresponding values in the objects
}
我没有这样的连接。但是,谢谢你的回复.. –
给你的连接字符串为你的分贝,请参考这个给连接-http://www.connectionstrings.com/mysql – SRIRAM
你能帮我在这...因为我发现我的加载问题是不是因为这个,而是因为我的一些编码循环..http://stackoverflow.com/questions/12947870/bindingdata-into-table-according-to-selection-in-the-dropdowns –
我更改属性可见false..But我不知道这是否会降低其加载时间..? –