Change
cmd.Parameters.AddWithValue("HNO", txthouseno.Text);
to
cmd.Parameters.AddWithValue("@HNO", txthouseno.Text);
and so on...
It should work as you have done it.
[UPDATE]
public bool insertfamily(OleDbCommand cmd)
{
if (conn.State == ConnectionState.Closed)
{ conn.Open(); }
string strqry = "INSERT INTO Family(Hno,Hname,Landphone,FullName,Mobile,DOB,Status,Gender)" + " Values(@HNO,@Hname,@Landphone,@Name,@Mobile,@Dob,@Status,@Gender)";
cmd = new OleDbCommand(strqry, conn);
cmd.Connection = conn;
cmd.CommandText = strqry;
cmd.CommandType = CommandType.Text;
var resultSet = cmd.ExecuteNonQuery();
if (resultSet.Equals(0))
{
MessageBox.Show("Records not inserted.please check", "My Application");
return false;
}
return true;
}
;