Error: SQLLite error, insufficient parameters supplied to the command.


Error:  SQLLite error, insufficient parameters supplied to the command.

DescriptionThis error occurs when you failed to provide or supply all the input output parameters to the command text or a stored procedure.

For example:

using (SQLiteCommand cmd = new SQLiteCommand("update usermaster set emailid = @emailid, @phone = @phone where userid = @userid", con))
{
  cmd.Parameters.Add(new SqliteParameter("@emailid", "test@in.com"));
  cmd.Parameters.Add(new SqliteParameter("@userid", 1));
}

Above command having three input parameters but we are supplying only two @emailid and @userid. During runtime, code will through above error.

Solution: Simple, just add the missing parameter to the command.

cmd.Parameters.Add(new SqliteParameter("@phone", 1));

Note: Also remember not to have any extra spaces, that will again throw above error. Avoid,

cmd.Parameters.Add(new SqliteParameter(" @phone", 1));
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s