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 :
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