+1  A: 

you will have to pass a parameter using out / ref keyword and parameters

As yo are using TableAdapters, you need to select the storedproceedure rather than a query for this operation.

when you select that, it will recognise the parameters itself.

when you call the method over your TableAdapter, which is SelectByName in this case, it is going to be something similar . Modify accordingly


// your TableAdapter
PatientTableAdapter adapter = new PatientTableAdapter();


// your input and output variables
string name = "somePatientName";
int patientID? = 0;
string returnedName? = "";

// TableAdapter Method, wired to Stored Proceedure
adapter.SelectByName("somePatientName", out patientID, out returnedName);

hope this helps

Asad Butt
and the query in the stored procedure will be like ?
Junaid Saeed
query is of your choice, I do not know your requirements Objects / DB / Tables. just keep in mind to pass on the right parameters to the method which is wired to SP.
Asad Butt