C# and SQL get declared parameters Data type and add the parameters dynamically

I'm having a problem in retrieving declared parameters in SQL query in C#.

Here is my SQL query in SQL server.

Declare @param1 int =1
Declare @param2 varhar(255)='Admin'

SELECT * FROM tblUsers WHERE role=@param2 AND id=@param1`

The query is executing successfully on SQL server.

I'd like to use C# to get all declared parameters and Data types. In this case:

@param1      int
@param2.     Varchar

Finally I'd like to assign the parameters values dynamically using textbox

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum