exception in my code

Feb 3 2012 1:44 PM
hello ;

i made a store procedure for crystal reporting. in this, when i enter patient reg no and then press "generate patient history" button. the following exception occur in the code.

exception :

Procedure 'patientrecord' expects parameter '@patient_regcode', which was not supplied.

now this is my code of button(report generate button)

protected void Button_generate_report_Click(object sender, EventArgs e)

{



cmd.CommandText =

SqlCommand cmd = new SqlCommand("patientrecord")ALTER procedure [dbo].patientrecord

@patient_regcode

as

begin

select

select [clinic patient registartion].[patient reg code],[clinic patient registartion].[patient name],
[clinic patient registartion].address,
[clinic patient registartion].[phone no],[clinic opd info].[pv id],
[clinic doctor].[name],[clinic pv treatments].[treatment id] from [clinic patient registartion],[clinic opd info],[clinic doctor],[clinic pv treatments] where [clinic patient registartion].[patient reg code]=@patient_regcode

end

cmd.Connection = connection.get();connection.get();//dataGridView1.DataSource = ds;

rpt.SetDataSource(ds);

report_patienthistory.ReportSource= rpt;

}


da.SelectCommand = cmd;

da.Fill(ds);


patient_emr rpt = new patient_emr();
SqlDataAdapter da = new SqlDataAdapter();DataTable ds = new DataTable();

Answers (1)