<The parameterized query '(@bid nvarchar(5),@rid nvarchar(4000),@total float,@duedate nvar' expects the parameter '@rid', which was not supplied. >

The Error Was Occur when i doing this calling this function.

 private void setBill()
            SqlCommand cmdBill = new SqlCommand("INSERT INTO Bill (BillID, RegistrationID, TotalFees, PaymentDueDate, Status) VALUES (@bid, @rid, @total, @duedate, @status)", conOOC);
            cmdBill.Parameters.AddWithValue("@bid", billID);
            cmdBill.Parameters.AddWithValue("@rid", txtRegistration);
            cmdBill.Parameters.AddWithValue("@total", double.Parse(lblTotalAmount.Text));
            cmdBill.Parameters.AddWithValue("@duedate", dtDueDate.ToShortDateString());
            cmdBill.Parameters.AddWithValue("@status", "PAID");


i can't find the solutions. Please Give Me A hand. Tq.

txtRegistration field is not having value , before calling function, make uset that field has some value.

i did it in when Page_Load function to retrieve previous page data. and i also tried to display it out when page. it's success.

but is it available in scope of setBill() function

you may debug or set print/message box in setbill fuction for txtRegistration

i've solve the problem by declaring public [variable]. tq