Tutorials ADO.NET Core Tutorial
Input Parameters — Complete Guide
Input Parameters — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of ADO.NET Core Tutorial on Toolliyo Academy.
On this page
ADO.NET Core Tutorial · Lesson 24 of 100
Input Parameters
Foundations ✓ → SQL & safety → Production → Projects
SQL & safety · 2 — Procs, tx, performance · ~6 min · Module 3: Stored Procedures
What is this?
Input parameters pass values into procedures (default direction Input).
Why should you care?
ShopNest filters, ids, and money amounts all enter as inputs.
See it live — copy this example
Use a .NET console or API project with SQL Server LocalDB. Run dotnet run after pasting.
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usp_Orders_GetByStatus";
cmd.Parameters.Add("@Status", SqlDbType.NVarChar, 20).Value = "Pending";
cmd.Parameters.Add("@Take", SqlDbType.Int).Value = 50;
What happened?
- Direction defaults to Input.
- Size NVarChar correctly.
- Pass DBNull.Value for SQL NULL.
Practice next
- Add two inputs.
- Pass DBNull for optional date.
- Mismatch types and read error.
- Omit optional param if proc has default.
- Use SqlDbType.Decimal precision/scale.
Remember
Input = into proc. Typed sizes. DBNull for nulls.
ShopNest status filter inputs
Ops UI passes Status + Take.
Outcome: Proc returns the right slice.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!