0
xitix created
4 Answer(s)
-
0
-
0
public JObject repo_GetListOFAssetDash(int ZoneID, int AssetID, int AssetType, string LocationStatus, string ServiceStatus, string Status, int RetailerID, int DNNUserID, string Area, int PageNumber, int PageSize) { //LocationStatus = ""; ServiceStatus = ""; //Status = ""; Area = "0"; SqlConnection connection = null; //if (_session.UserId == 6 || _session.UserId == 8) //{ // connection = EnsureConnectionOpen_Frigo(); //} //else //{ // connection = EnsureConnectionOpen_TNT(); //} connection = EnsureConnOpen_ByTenantId(getTenantId()); JObject result = new JObject(); SqlCommand cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "usp_NG_Dashboard_Pagination_New1"; cmd.Parameters.AddWithValue("@ZoneID", ZoneID); cmd.Parameters.AddWithValue("@AssetID", AssetID); cmd.Parameters.AddWithValue("@AssetType", AssetType); cmd.Parameters.AddWithValue("@LocationStatus", LocationStatus); cmd.Parameters.AddWithValue("@ServiceStatus", ServiceStatus); cmd.Parameters.AddWithValue("@Status", Status); cmd.Parameters.AddWithValue("@RetailerID", RetailerID); cmd.Parameters.AddWithValue("@DNNUserID", DNNUserID); cmd.Parameters.AddWithValue("@Area", Area); cmd.Parameters.AddWithValue("@PageNumber", PageNumber); cmd.Parameters.AddWithValue("@PageSize", PageSize); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); result = DataSetToJSon.WriteJson(ds, "ListOfAssets"); cmd.Dispose(); connection.Dispose(); connection.Close(); return result; }
-
0
If it is really a problem caused by time, you can try
SqlCommand.CommandTimeout
property.https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.commandtimeout?view=netcore-3.0
SqlCommand cmd = new SqlCommand(); cmd.Connection = connection; cmd.CommandTimeout = 30; //30s
-
0
Thanks