<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");

            conOOC.Open();
            cmdBill.ExecuteNonQuery();
            conOOC.Close();
        }

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

Recommended Answers

All 4 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.