Avatar of Seven price
Seven price
Flag for United States of America

asked on 

entity DataTable

how can i take this
 private DataTable GetRecords()
   {
    
         using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()))
             {
           // Open the connection. 
          
          conn.Open();
          SqlCommand command = new SqlCommand();
          command.Connection = conn;
          command.CommandTimeout = 15;
          command.CommandType = CommandType.StoredProcedure;
          command.CommandText = "storedprocedureconnect";

          
           command.Parameters.Add("@paramvalue1", SqlDbType.VarChar, 6).Value = "myvalue";
           command.Parameters.Add("@paramvalue2", SqlDbType.Int).Value = 0;
           SqlDataAdapter dA = new SqlDataAdapter();
                      DataSet objDs = new DataSet();
           dA.SelectCommand = command;
           dA.Fill(objDs);
           return objDs.Tables[0];
      }
}

Open in new window

And convert it to use
 Entities entityBuilder = new Entities();
And entity storedprocedure function?
.NET ProgrammingMicrosoft Development

Avatar of undefined
Last Comment
Seven price

8/22/2022 - Mon