0

<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.

2
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by gahhon
0

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

0

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.

0

but is it available in scope of setBill() function

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.