Click here to Skip to main content
15,914,327 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am facing one problem in my code behind (asp.net and vb.net)

i am binding data into my gridview

i have 1000 records in my storedprocedure
when i execute the storedprocedure in sql server then the resul will come within 20 seconds
but when i execute the same stored procedure on my module then it will take 10 minutes

am facing the below place to take 10 minutes
my code is :
C#
TID1 = 1
        TID2 = 2
        TID3 = DBNull.Value
        TID4 = DBNull.Value
        Ownership = DBNull.Value

        BillSeries = DBNull.Value
        ZoneCode = DBNull.Value
        StoreType = DBNull.Value
        StoreCluster = DBNull.Value
        StoreBrand = DBNull.Value
        RegionCode = DBNull.Value
        StoreCode = DBNull.Value
        FromDate = "05-10-2016"
        ToDate = "05-10-2016"

        'Dim constring As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim constring As String = ConfigurationManager.AppSettings("ConnectionString").ToString()
        Dim con As SqlConnection = New SqlConnection(constring)
        Dim cmd As SqlCommand = New SqlCommand("test", con)
        cmd.CommandType = CommandType.StoredProcedure


        cmd.Parameters.AddWithValue("ZCode", ZoneCode)
        cmd.Parameters.AddWithValue("SType", StoreType)
        cmd.Parameters.AddWithValue("SCluster", StoreCluster)
        cmd.Parameters.AddWithValue("SBrand", StoreBrand)
        cmd.Parameters.AddWithValue("RCode", RegionCode)
        cmd.Parameters.AddWithValue("SCode", StoreCode)
        cmd.Parameters.AddWithValue("FDate", FromDate)
        cmd.Parameters.AddWithValue("TDate", ToDate)
        cmd.Parameters.AddWithValue("own", Ownership)
        cmd.Parameters.AddWithValue("TID1", TID1)
        cmd.Parameters.AddWithValue("TID2", TID2)
        cmd.Parameters.AddWithValue("TID3", TID3)
        cmd.Parameters.AddWithValue("TID4", TID4)
        cmd.Parameters.AddWithValue("BSeries", BillSeries)

        con.Open()

        Dim DS As DataSet = New DataSet

        Dim DA As SqlDataAdapter = New SqlDataAdapter(cmd)
        DA.Fill(DS)  ' here am getting slow
        GridView1.DataSource = DS
        GridView1.DataBind()

        con.Close()



please drop me a solution for this.
thanks in advance

What I have tried:

Taking too much of time to bind data into gridview
Posted
Updated 5-Oct-16 0:53am
v2
Comments
ZurdoDev 5-Oct-16 7:58am    
What is likely taking so long is your browser trying to display and render 1000 records. You should implement paging.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900