Đối tượng SqlCommand là gì?
Đối tượng SqlCommand là gì?
SqlCommand biểu diễn một câu lệnh SQL hoặc stored procedure thực thi trên CSDL SQL Server.
// Truy vấn có tham số
await using var cmd = new SqlCommand("SELECT * FROM Users WHERE Email = @email", conn);
cmd.Parameters.Add("@email", SqlDbType.NVarChar, 256).Value = email;
// Stored procedure
await using var sp = new SqlCommand("dbo.usp_PlaceOrder", conn) { CommandType = CommandType.StoredProcedure, CommandTimeout = 30 };
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.