Link to home
Start Free TrialLog in
Avatar of kshumway
kshumwayFlag for United States of America

asked on

Passing parameter to Stored Procedure

I have the following stored procedure.  I want to pass HTCode from my VB.Net subroutine and then received the values back in a datatable.  Is that possible?  If so, could someone help me out with the code?
ALTER PROCEDURE dbo.HospBillingCodeLoop
	(
	@HTCode varchar(50)
	)
AS
	SELECT * FROM [Hospital Billing Data SQL] WHERE HTCode = @HTCode 
	RETURN

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of appari
appari
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
something like this:

con.ConnectionString = Settings.ConnectionString("myDB");
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "HospBillingCodeLoop"
cmd.Parameters.Add("@HTCode ", SqlDbType.Int).Value = HTCode;
DataReader dr = cmd.ExecuteReader();
DataSet ds = new Dataset();
ds.Load(dr);
...
Avatar of kshumway

ASKER

Thank you!  It worked perfectly.