none
(Stored Procedure and Ado.Net) or linq? RRS feed

  • Question

  • Hello
    which one is work more fast for query ? (For example 500.000 records or 2.000.000 records)
    (Stored Procedure and Ado.Net) or linq?
    I have one more question. linq use Stored procedure ?
    Thanks
    • Moved by Bob Beauchemin Monday, December 28, 2009 2:49 PM Moved to a more appropriate group (From:.NET Framework inside SQL Server)
    Saturday, December 26, 2009 10:12 AM

All replies

  • Are you talking about comparing a .NET stored procedure (a stored procedure written in .NET code) vs a LINQ query? Or a SQL stored procedure vs a LINQ query? If you're talking about a SQL stored procedure vs a LINQ query, you're in the wrong forum. Let me know and I'll move it to either the LINQ2SQL forum or Entity Framework forum (if you're using LINQ to entities).

    And yes, LINQ to SQL and LINQ to Entities can use most stored procedures to talk to the database.

    You cannot safely write a .NET stored procedure using LINQ, because neither LINQ2SQL or Entity Framework is on the list of system assemblies approved for SQLCLR.

    Hope this helps,
    Bob Beauchemin
    SQLskills
    Saturday, December 26, 2009 6:03 PM
  • Hello i have two query at below. which one is work more fast ?




    Dim Nortwind as new nortwinddatacontext() dim producthistory=nortwind.StoredProcedure //it is LinQ with StoredProcedure
      using (SqlConnection con = new SqlConnection(conString))
                    {
                        cmd = new SqlCommand("SELECT x_sayac FROM x_sayac Where x_id=@x_id", con);
                        SqlParameter id1 = cmd.Parameters.Add("@x_id", SqlDbType.Int);
                        id1.Direction = ParameterDirection.Input;
                        id1.Value = 1;
                        
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        DataTable dt = new DataTable();
                        da.Fill(dt);
    
                        sayac = Convert.ToDouble(dt.Rows[0]["x_sayac"]);
                        sayac++;
                        textBox1.Text = Convert.ToString(sayac);
                        con.Dispose();
                    } ' it is Ado with Stored Procedure.
    Monday, December 28, 2009 8:23 AM