Eg Net Solution: Stored Procedure

Here in this sites web and software developer can get some essential information.

MY Favorite .Net Question For Interview

This are not tidy. Just for rough. In Sha Allah will make it tiddy soon. 1.  DateTime2 Date range 0001-01-01 through 9999-12-31  vs Date...

Users Countries


Showing posts with label Stored Procedure. Show all posts
Showing posts with label Stored Procedure. Show all posts

Thursday, November 1, 2018

Using SqlClient connect to sql server and CRUD in Databse thorough Stored Procedure

November 01, 2018 0
Using SqlClient  connect to sql server and CRUD in Databse thorough Stored Procedure

  1.   public List<LDNo> LDNoList(Int64? LDNo)
  2.         {

  3.             ResultModel result = new Models.ViewModel.CommonViewModel.ResultModel();
  4.             string error = String.Empty;
  5.             QUERY2 query = new QUERY2();
  6.             Dictionary<string, object> dict = new Dictionary<string, object>();//= new Dictionary<string, string> 
  7.             List<LDNo> ldnoList = new List<LDNo>();

  8.             dict.Add("@LDNO", LDNo);
  9.             dict.Add("@Result", 1.ToString());
  10.             dict.Add("@Message", "Message".ToString());
  11.             query.SQL = @"SPROC_GET_tblDyesForecastingHead_LDNO";
  12.             query.PARAMETER = dict;
  13.             clsDataprocess cls = new clsDataprocess();
  14.             result = cls.ExecuteSqlStoredProcedureSaveEdit(query, "get", out error);
  15.             if (result.Result && result.DtTable != null && result.DtTable.Rows.Count > 0)
  16.             {
  17.                 Int64 tempi = 0;
  18.                 for (int i = 0; i < result.DtTable.Rows.Count; i++)
  19.                 {
  20.                     LDNo lDNo = new LDNo();
  21.                     Int64.TryParse(result.DtTable.Rows[i]["LDNO"].ToString(), out tempi);
  22.                     lDNo.LdNo = tempi;
  23.                     ldnoList.Add(lDNo);

  24.                 }
  25.                 string Message = result.Message;
  26.                 string Result = result.Result.ToString();
  27.             }
  28.             else if (!result.Result)
  29.             {
  30.                 throw new Exception(result.Message);
  31.             }

  32.             return ldnoList;
  33.         }

Add Choice