YellowSubmarine
YellowSubmarine

Reputation: 151

The parameterized query was not supplied

I am still not accustomed to c# programming, specially in SQL. The error states:

The parameterized query '(@ProdNo varchar(8000))DELETE FROM [ORDER] WHERE ProdNo = @ProdN' expects the parameter '@ProdNo', which was not supplied.

I don't know what to do. I need help. Thanks!

public void DeleteRecord()
{
            SqlCommand cmd = new SqlCommand("DELETE FROM [ORDER] WHERE ProdNo = @ProdNo", myCon);
            cmd.Parameters.Add("@ProdNo", SqlDbType.VarChar).Value = username;

            myCon.Open();
            cmd.ExecuteNonQuery();
            myCon.Close();
        }

Upvotes: 0

Views: 99

Answers (1)

ΩmegaMan
ΩmegaMan

Reputation: 31721

Since ProdNo appears to be character values and not a numeric, change your sql to, sql quote the value such as:

DELETE FROM [ORDER] WHERE ProdNo = '@ProdNo'

Upvotes: 1

Related Questions